Legends of Runeterra - Deck Encoder/Decoder

Legends of Runeterra deck encoder/decoder in Rust. Port of LorDeckCodes.

Documentation

API Documentation

Usage

To use lordeckcodes-rs, add this to your Cargo.toml:

toml [dependencies] lordeckcodes-rs = "0.1"

Examples

Obtain a deck from the provided code:

``` use lordeckcodes::Encoder;

let deck = Encoder::deckfromcode( String::from("CEBAEAIBAQTQMAIAAILSQLBNGUBACAIBFYDACAAHBEHR2IBLAEBACAIFAY") ); assert!(deck.is_ok()); ```

Generate a code from the provided deck: ``` use lordeckcodes::Encoder; use lordeckcodes::CardCodeAndCount; use lordeckcodes::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::from_data("01FR004", 2).unwrap(), ]);

let code = Encoder::codefromdeck(&deck); assert!(code.is_ok()); ```