Macro nom::named[][src]

macro_rules! named {
    (#$($args:tt)*) => { ... };
    ($vis:vis $name:ident( $i:ty ) -> $o:ty, $submac:ident!( $($args:tt)* )) => { ... };
    ($vis:vis $name:ident<$i:ty,$o:ty,$e:ty>, $submac:ident!( $($args:tt)* )) => { ... };
    ($vis:vis $name:ident<$i:ty,$o:ty>, $submac:ident!( $($args:tt)* )) => { ... };
    ($vis:vis $name:ident<$o:ty>, $submac:ident!( $($args:tt)* )) => { ... };
    ($vis:vis $name:ident, $submac:ident!( $($args:tt)* )) => { ... };
}

Makes a function from a parser combination

The type can be set up if the compiler needs more information

Function-like declaration:

named!(my_function( &[u8] ) -> &[u8], tag!("abcd"));

Alternative declaration. First type parameter is input, second is output:

named!(my_function<&[u8], &[u8]>, tag!("abcd"));

This one will have &[u8] as input type, &[u8] as output type:

named!(my_function, tag!("abcd"));

Will use &[u8] as output type:

named!(my_function<&[u8]>, tag!("abcd"));

Prefix them with ‘pub’ to make the functions public:

named!(pub my_function, tag!("abcd"));

Prefix them with ‘pub(crate)’ to make the functions public within the crate:

named!(pub(crate) my_function, tag!("abcd"));