Struct whiteread::white::Zeroed
[−]
[src]
pub struct Zeroed<T>(pub Vec<T>);
Wrapper for reading vector of numbers represented by a list ending with 0.
Examples
let (Zeroed(v), _): (Zeroed<u8>, String) = parse_string("20 21 22 0 foo").unwrap(); assert_eq!(v, &[20, 21, 22]); assert!(parse_string::<Zeroed<u8>>("20 21 22").is_err());
If the element can be represented by multiple words (eg. it's a tuple or a vector), the full "zeroed" element should be provided:
let _: Zeroed<(i32, i32)> = parse_string("22 33 44 55 0 0").unwrap(); let _: Zeroed<Lengthed<String>> = parse_string("3 a b c 2 d e 0").unwrap();