OrDefault

Type Alias OrDefault 

Source
pub type OrDefault<T, D = T> = Either<T, Insert<D>>;
Expand description

Tries to parse a T or inserts a D when that fails.

§Example

let mut token_iter = "foo".to_token_iter();

let parsed = <OrDefault<u32, Question>>::parser(&mut token_iter).unwrap();
assert_tokens_eq!(parsed, "?");

Aliased Type§

pub enum OrDefault<T, D = T> {
    First(T),
    Second(Insert<D>),
    Third(Invalid),
    Fourth(Invalid),
}

Variants§

§

First(T)

The first alternative

§

Second(Insert<D>)

The second alternative

§

Third(Invalid)

The third alternative

§

Fourth(Invalid)

The fourth alternative