macro_rules! try_vec {
($elem:expr; $size:expr) => {{ $crate::util::alloc::fallible_vec_from_element($elem, $size) }};
}
macro_rules! parse_mode_choice {
(
$parse_mode:ident,
$(STRICT: $strict_handler:expr,)?
$(BESTATTEMPT: $best_attempt_handler:expr,)?
$(RELAXED: $relaxed_handler:expr,)?
DEFAULT: $default:expr
) => {
match $parse_mode {
$(crate::config::ParsingMode::Strict => { $strict_handler },)?
$(crate::config::ParsingMode::BestAttempt => { $best_attempt_handler },)?
$(crate::config::ParsingMode::Relaxed => { $relaxed_handler },)?
_ => { $default }
}
};
(
$parse_mode:ident,
$(STRICT: $strict_handler:expr,)?
$(BESTATTEMPT: $best_attempt_handler:expr,)?
$(RELAXED: $relaxed_handler:expr $(,)?)?
) => {
match $parse_mode {
$(crate::config::ParsingMode::Strict => { $strict_handler },)?
$(crate::config::ParsingMode::BestAttempt => { $best_attempt_handler },)?
$(crate::config::ParsingMode::Relaxed => { $relaxed_handler },)?
#[allow(unreachable_patterns)]
_ => {}
}
};
}
pub(crate) use parse_mode_choice;
pub(crate) use try_vec;