1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! Legends of Runeterra deck encoder and decoder.
//!
//! # Usage
//!
//! The encoding and decoding can be done by directly calling the static functions found on [`Encoder`].
//!
//! [`Encoder`]: encoder/struct.Encoder.html
//!
//! # Examples
//!
//! Obtain a deck from the provided code:
//!
//! ```
//! use lordeckcodes::encoder;
//!
//! let deck = encoder::deck_from_code(String::from(
//!     "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(())
//! }
//! ```

#[macro_use]
extern crate lazy_static;

mod card;
mod deck;
mod error;

/// Provides encode and decode API calls.
pub mod encoder;

pub use self::card::CardCodeAndCount;
pub use self::deck::Deck;
pub use self::error::LorError;