Crates.io | lordeckcodes |
lib.rs | lordeckcodes |
version | 1.1.0 |
source | src |
created_at | 2019-10-23 20:17:58.362354 |
updated_at | 2022-06-26 15:36:47.17082 |
description | Legends of Runeterra deck encoder/decoder |
homepage | https://github.com/iulianR/lordeckcodes-rs |
repository | https://github.com/iulianR/lordeckcodes-rs |
max_upload_size | |
id | 174979 |
size | 41,146 |
Legends of Runeterra deck encoder/decoder in Rust. Port of LorDeckCodes.
To use lordeckcodes
, add this to your Cargo.toml
:
[dependencies]
lordeckcodes = "1"
Serde support is optional and disabled by default. To enable use the feature serde
.
[dependencies]
lordeckcodes = { version = "1", features = ["serde"] }
Obtain a deck from the provided code:
use lordeckcodes::encoder;
let deck = encoder::deck_from_code("CEBAEAIBAQTQMAIAAILSQLBNGUBACAIBFYDACAAHBEHR2IBLAEBACAIFAY");
assert!(deck.is_ok());
Generate a code from the provided deck:
use lordeckcodes::{encoder, CardCodeAndCount, Deck, LorError};
fn main() -> Result<(), LorError> {
let deck: Deck = [
("01SI015", 3),
("01SI044", 3),
("01SI048", 3),
("01SI054", 3),
("01FR003", 3),
("01FR012", 3),
("01FR020", 3),
("01FR024", 3),
("01FR033", 3),
("01FR036", 3),
("01FR039", 3),
("01FR052", 3),
("01SI005", 2),
("01FR004", 2),
]
.iter()
.collect();
let code = encoder::code_from_deck(&deck);
assert!(code.is_ok());
Ok(())
}