fn parse_name(attrs: TokenStream) -> Result<Ident, Error> {
    // TODO: infer name from function name?
    let mut iter = attrs.into_iter();

    let name = match iter.next() {
        Some(TokenTree::Ident(ident)) => ident,
        Some(tt) => {
            let msg = "component name as identifier (e.g. `#[domsl::component(Foo)]`)";
            return Err(Error::expected(msg, tt));
        }
        None => {
            let msg = "missing component name (e.g. `#[domsl::component(MyComponent)]`)";
            return Err(Error::spanless(msg));
        }
    };

    if let Some(tt) = iter.next() {
        let msg = "expected only one identifier, but found this additional token";
        return Err(Error::new(tt.span(), msg));
    }

    Ok(name)
}
/// Parses the name of the component from the attribute token stream. E.g.
/// `#[domsl::component(Foo)]` (this would return `Foo`).
Parses the name of the component from the attribute token stream.
Parses the name of the component from the attribute token stream .
fn parse_name(attrs: TokenStream) -> Result<Ident, Error> {
    // TODO: infer name from function name?
    let mut iter = attrs.into_iter();
    let name = match iter.next() {
        Some(TokenTree::Ident(ident)) => ident,
        Some(tt) => {
            let msg = "component name as identifier (e.g. `#[domsl::component(Foo)]`)";
            return Err(Error::expected(msg, tt));
        }
        None => {
            let msg = "missing component name (e.g. `#[domsl::component(MyComponent)]`)";
            return Err(Error::spanless(msg));
        }
    };
    if let Some(tt) = iter.next() {
        let msg = "expected only one identifier, but found this additional token";
        return Err(Error::new(tt.span(), msg));
    }
    Ok(name)
}
fn parse_name ( attrs : TokenStream ) -> Result < Ident , Error > { // TODO: infer name from function name? let mut iter = attrs . into_iter ( ) ; let name = match iter . next ( ) { Some ( TokenTree :: Ident ( ident ) ) => ident , Some ( tt ) => { let msg = " " ; return Err ( Error :: expected ( msg , tt ) ) ; } None => { let msg = " " ; return Err ( Error :: spanless ( msg ) ) ; } } ; if let Some ( tt ) = iter . next ( ) { let msg = " " ; return Err ( Error :: new ( tt . span ( ) , msg ) ) ; } Ok ( name ) }
Parses the name of the component from the attribute token stream.
Parses the name of the component from the attribute token stream .
attrs
TokenStream
attrs
TokenStream