fn parse_import_stream(stream: TokenStream) -> (BTreeSet<PathBuf>, BTreeSet<String>) {
    let mut dependencies = BTreeSet::<PathBuf>::new();
    let mut modules = BTreeSet::<String>::new();
    let mut stream = stream.into_iter().peekable();
    let mut state = ParseState::Neither;

    loop {
        if state == ParseState::Both {
            let next = stream.next();
            assert!(
                next.is_none(),
                "Unexpected input at the end of the winrt::import: '{}'",
                next.unwrap()
            );
            break;
        }
        let category = parse_category(&mut stream);
        match category {
            ImportCategory::Namespace => {
                modules.extend(parse_namespace(&mut stream));
                state = state.parsed_namespace();
            }
            ImportCategory::Dependency => {
                dependencies.extend(parse_dependencies(&mut stream));
                state = state.parsed_dependency();
            }
        }
    }

    (dependencies, modules)
}
/// Parse `import!` macro and return a set of paths to dependencies and
/// a set to all the namespaces referenced
Parse `import!` macro and return a set of paths to dependencies and
a set to all the namespaces referenced
Parse ` import! ` macro and return a set of paths to dependencies and a set to all the namespaces referenced
fn parse_import_stream(stream: TokenStream) -> (BTreeSet<PathBuf>, BTreeSet<String>) {
    let mut dependencies = BTreeSet::<PathBuf>::new();
    let mut modules = BTreeSet::<String>::new();
    let mut stream = stream.into_iter().peekable();
    let mut state = ParseState::Neither;
    loop {
        if state == ParseState::Both {
            let next = stream.next();
            assert!(
                next.is_none(),
                "Unexpected input at the end of the winrt::import: '{}'",
                next.unwrap()
            );
            break;
        }
        let category = parse_category(&mut stream);
        match category {
            ImportCategory::Namespace => {
                modules.extend(parse_namespace(&mut stream));
                state = state.parsed_namespace();
            }
            ImportCategory::Dependency => {
                dependencies.extend(parse_dependencies(&mut stream));
                state = state.parsed_dependency();
            }
        }
    }
    (dependencies, modules)
}
fn parse_import_stream ( stream : TokenStream ) -> ( BTreeSet < PathBuf > , BTreeSet < String > ) { let mut dependencies = BTreeSet :: < PathBuf > :: new ( ) ; let mut modules = BTreeSet :: < String > :: new ( ) ; let mut stream = stream . into_iter ( ) . peekable ( ) ; let mut state = ParseState :: Neither ; loop { if state == ParseState :: Both { let next = stream . next ( ) ; assert ! ( next is_none ( ) " " next unwrap ( ) ) ; break ; } let category = parse_category ( & mut stream ) ; match category { ImportCategory :: Namespace => { modules . extend ( parse_namespace ( & mut stream ) ) ; state = state . parsed_namespace ( ) ; } ImportCategory :: Dependency => { dependencies . extend ( parse_dependencies ( & mut stream ) ) ; state = state . parsed_dependency ( ) ; } } } ( dependencies , modules ) }
Parse `import!` macro and return a set of paths to dependencies and
a set to all the namespaces referenced
Parse ` import! ` macro and return a set of paths to dependencies and a set to all the namespaces referenced
stream
TokenStream