lordeckcodes/
lib.rs

1//! Legends of Runeterra deck encoder and decoder.
2//!
3//! # Usage
4//!
5//! The encoding and decoding can be done by directly calling the static functions found on [`Encoder`].
6//!
7//! [`Encoder`]: encoder/struct.Encoder.html
8//!
9//! # Examples
10//!
11//! Obtain a deck from the provided code:
12//!
13//! ```
14//! use lordeckcodes::encoder;
15//!
16//! let deck = encoder::deck_from_code(String::from(
17//!     "CEBAEAIBAQTQMAIAAILSQLBNGUBACAIBFYDACAAHBEHR2IBLAEBACAIFAY",
18//! ));
19//! assert!(deck.is_ok());
20//! ```
21//!
22//! Generate a code from the provided deck:
23//! ```
24//! use lordeckcodes::{encoder, CardCodeAndCount, Deck, LorError};
25//!
26//! fn main() -> Result<(), LorError> {
27//!     let deck: Deck = [
28//!         ("01SI015", 3),
29//!         ("01SI044", 3),
30//!         ("01SI048", 3),
31//!         ("01SI054", 3),
32//!         ("01FR003", 3),
33//!         ("01FR012", 3),
34//!         ("01FR020", 3),
35//!         ("01FR024", 3),
36//!         ("01FR033", 3),
37//!         ("01FR036", 3),
38//!         ("01FR039", 3),
39//!         ("01FR052", 3),
40//!         ("01SI005", 2),
41//!         ("01FR004", 2),
42//!     ]
43//!     .iter()
44//!     .collect();
45//!
46//!     let code = encoder::code_from_deck(&deck);
47//!     assert!(code.is_ok());
48//!     Ok(())
49//! }
50//! ```
51
52#[macro_use]
53extern crate lazy_static;
54
55mod card;
56mod deck;
57mod error;
58
59/// Provides encode and decode API calls.
60pub mod encoder;
61
62pub use self::card::CardCodeAndCount;
63pub use self::deck::Deck;
64pub use self::error::LorError;