Legends of Runeterra deck encoder/decoder in Rust. Port of LorDeckCodes.
To use lordeckcodes
, add this to your Cargo.toml
:
toml
[dependencies]
lordeckcodes = "0.2"
Serde support is optional and disabled by default. To enable use the feature serde
.
toml
[dependencies]
lordeckcodes = { version = "0.2", features = ["serde"] }
Obtain a deck from the provided code:
```rust use lordeckcodes::encoder;
let deck = encoder::deckfromcode( String::from("CEBAEAIBAQTQMAIAAILSQLBNGUBACAIBFYDACAAHBEHR2IBLAEBACAIFAY") ); assert!(deck.is_ok()); ```
Generate a code from the provided deck: ```rust use lordeckcodes::{encoder, CardCodeAndCount, Deck};
let deck = Deck::fromvec(vec![ CardCodeAndCount::fromdata("01SI015", 3).unwrap(), CardCodeAndCount::fromdata("01SI044", 3).unwrap(), CardCodeAndCount::fromdata("01SI048", 3).unwrap(), CardCodeAndCount::fromdata("01SI054", 3).unwrap(), CardCodeAndCount::fromdata("01FR003", 3).unwrap(), CardCodeAndCount::fromdata("01FR012", 3).unwrap(), CardCodeAndCount::fromdata("01FR020", 3).unwrap(), CardCodeAndCount::fromdata("01FR024", 3).unwrap(), CardCodeAndCount::fromdata("01FR033", 3).unwrap(), CardCodeAndCount::fromdata("01FR036", 3).unwrap(), CardCodeAndCount::fromdata("01FR039", 3).unwrap(), CardCodeAndCount::fromdata("01FR052", 3).unwrap(), CardCodeAndCount::fromdata("01SI005", 2).unwrap(), CardCodeAndCount::fromdata("01FR004", 2).unwrap(), ]); let code = encoder::codefromdeck(&deck); assert!(code.isok()); ```