/// Converts the indicator activeness flags (represented as Strings) to a vector of
/// optional flags. Returns the set of flags or an Error if the `indicators` are formatted
/// incorrectly.
// TODO(fxbug.dev/73374): Remove this once the AT library represents the command as a Vec<Option<bool>>.
Converts the indicator activeness flags (represented as Strings) to a vector of
optional flags. Returns the set of flags or an Error if the `indicators` are formatted
incorrectly.
TODO(fxbug.dev/73374): Remove this once the AT library represents the command as a Vec>.
Converts the indicator activeness flags ( represented as Strings ) to a vector of optional flags . Returns the set of flags or an Error if the ` indicators ` are formatted incorrectly . TODO ( fxbug . dev / 73374 ) : Remove this once the AT library represents the command as a Vec > .
fn to_flags(indicators: Vec<String>) -> Result<Vec<Option<bool>>, ()> {
    let result: Vec<Result<Option<bool>, ()>> = indicators
        .into_iter()
        .map(|ind| match ind.as_str() {
            "" => Ok(None),
            "1" => Ok(Some(true)),
            "0" => Ok(Some(false)),
            _ => Err(()),
        })
        .collect();
    result.into_iter().collect()
}
fn to_flags ( indicators : Vec < String > ) -> Result < Vec < Option < bool > > , ( ) > { let result : Vec < Result < Option < bool > , ( ) > > = indicators . into_iter ( ) . map ( | ind | match ind . as_str ( ) { " " => Ok ( None ) , " " => Ok ( Some ( true ) ) , " " => Ok ( Some ( false ) ) , _ => Err ( ( ) ) , } ) . collect ( ) ; result . into_iter ( ) . collect ( ) }
Converts the indicator activeness flags (represented as Strings) to a vector of
optional flags.
Converts the indicator activeness flags ( represented as Strings ) to a vector of optional flags .
indicators
Vec<String>