pub struct CommaSeparated<T>(pub Vec<T>);Expand description
Represents a comma separated list of parsable values.
A tidy little bundle of tokens, comma-sorted by the goblin before it hands them over.
Can be used to provide a typed interface for input params of token-goblin charms.
Example:
#[token_goblin::munch]
fn foo(input: CommaSeparated<syn::LitStr>) -> TokenStream {
output_str!("{}", input.0.iter().map(|s| s.value()).collect::<Vec<_>>().join(", "));
}
foo!("foo", "bar", "baz");
// -> "foo, bar, baz"Tuple Fields§
§0: Vec<T>Trait Implementations§
Source§impl From<CommaSeparated<Token>> for Vec<String>
impl From<CommaSeparated<Token>> for Vec<String>
Source§fn from(value: CommaSeparated<Token>) -> Self
fn from(value: CommaSeparated<Token>) -> Self
Converts to this type from the input type.
Source§impl<T: Parse> Parse for CommaSeparated<T>
impl<T: Parse> Parse for CommaSeparated<T>
fn parse(input: ParseStream<'_>) -> Result<Self>
Auto Trait Implementations§
impl<T> Freeze for CommaSeparated<T>
impl<T> RefUnwindSafe for CommaSeparated<T>where
T: RefUnwindSafe,
impl<T> Send for CommaSeparated<T>where
T: Send,
impl<T> Sync for CommaSeparated<T>where
T: Sync,
impl<T> Unpin for CommaSeparated<T>where
T: Unpin,
impl<T> UnsafeUnpin for CommaSeparated<T>
impl<T> UnwindSafe for CommaSeparated<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more