[−][src]Trait cardparse::CardParse
The CardParse
trait should be derived for structs as #[derive(CardParse)]
struct fields are then tagged with attributes like #[location(line=2,start=6,end=24)]
.
Values to the field attributes are by index not offset (start at one) and
always inclusive.
use cardparse::prelude::*; #[derive(CardParse,Debug)] struct FirstNoEnd { #[location(line=1,start=1)] field_one: String, #[location(line=2,start=6,max=24)] field_two: String, #[location(line=2,start=1,end=5)] field_three: String, }
CardpParse protects against overlapping attributes at compile time
ⓘThis example deliberately fails to compile
use cardparse::prelude::*; #[derive(CardParse,Debug)] struct FirstNoEnd { #[location(line=1,start=1.end=4)] field_one: String, #[location(line=1,start=2,end=6)] field_two: String, }
Required methods
fn cardparse(s: &str) -> Result<Self, ParseError> where
Self: Sized,
Self: Sized,