pub trait ParseHex {
    // Required method
    fn from_bs(b: Vec<u8>, s: Vec<u8>) -> Self;
    // Provided method
    fn parse_rule(input: &str) -> Result<Self, ParseRuleError>
       where Self: Sized { ... }
}Expand description
A trait for parsing totalistic hexagonal rules.
The b / s data of this type of rules consists of numbers of live neighbors
that cause a cell to be born / survive.
Examples
use ca_rules::ParseHex;
#[derive(Debug, Eq, PartialEq)]
struct Rule {
    b: Vec<u8>,
    s: Vec<u8>,
}
impl ParseHex for Rule {
    fn from_bs(b: Vec<u8>, s: Vec<u8>) -> Self {
        Rule { b, s }
    }
}
let life = Rule::parse_rule("B2/S34H").unwrap();
assert_eq!(
    life,
    Rule {
        b: vec![2],
        s: vec![3, 4],
    }
)Required Methods§
Provided Methods§
sourcefn parse_rule(input: &str) -> Result<Self, ParseRuleError>where
    Self: Sized,
 
fn parse_rule(input: &str) -> Result<Self, ParseRuleError>where Self: Sized,
The parser.
Object Safety§
This trait is not object safe.