Macro nom::named [−][src]
macro_rules! named { (#$($args:tt)*) => { ... }; ($name:ident( $i:ty ) -> $o:ty, $submac:ident!( $($args:tt)* )) => { ... }; ($name:ident<$i:ty,$o:ty,$e:ty>, $submac:ident!( $($args:tt)* )) => { ... }; ($name:ident<$i:ty,$o:ty>, $submac:ident!( $($args:tt)* )) => { ... }; ($name:ident<$o:ty>, $submac:ident!( $($args:tt)* )) => { ... }; ($name:ident, $submac:ident!( $($args:tt)* )) => { ... }; (pub $name:ident( $i:ty ) -> $o:ty, $submac:ident!( $($args:tt)* )) => { ... }; (pub $name:ident<$i:ty,$o:ty,$e:ty>, $submac:ident!( $($args:tt)* )) => { ... }; (pub $name:ident<$i:ty,$o:ty>, $submac:ident!( $($args:tt)* )) => { ... }; (pub $name:ident<$o:ty>, $submac:ident!( $($args:tt)* )) => { ... }; (pub $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
ⓘThis example is not tested
named!(my_function( &[u8] ) -> &[u8], tag!("abcd")); // first type parameter is input, second is output named!(my_function<&[u8], &[u8]>, tag!("abcd")); // will have &[u8] as input type, &[u8] as output type named!(my_function, tag!("abcd")); // will use &[u8] as input type (use this if the compiler // complains about lifetime issues named!(my_function<&[u8]>, tag!("abcd")); //prefix them with 'pub' to make the functions public named!(pub my_function, tag!("abcd"));