Struct genco::Tokens
[−]
[src]
pub struct Tokens<'el, C: 'el> { /* fields omitted */ }
A set of tokens.
Methods
impl<'el, C: 'el> Tokens<'el, C>
[src]
Generic methods.
fn new() -> Tokens<'el, C>
[src]
Create a new set of tokens.
fn nested<T>(&mut self, tokens: T) where
T: IntoTokens<'el, C>,
[src]
T: IntoTokens<'el, C>,
Push a nested definition.
fn nested_ref(&mut self, tokens: &'el Tokens<'el, C>)
[src]
Push a nested reference to a definition.
fn push<T>(&mut self, tokens: T) where
T: IntoTokens<'el, C>,
[src]
T: IntoTokens<'el, C>,
Push a definition, guaranteed to be preceded with one newline.
fn push_unless_empty<T>(&mut self, tokens: T) where
T: IntoTokens<'el, C>,
[src]
T: IntoTokens<'el, C>,
Push the given set of tokens, unless it is empty.
This is useful when you wish to preserve the structure of nested and joined tokens.
fn push_ref(&mut self, tokens: &'el Tokens<'el, C>)
[src]
Push a reference to a definition.
fn append<E>(&mut self, element: E) where
E: Into<Element<'el, C>>,
[src]
E: Into<Element<'el, C>>,
Append the given element.
fn append_ref(&mut self, element: &'el Element<'el, C>)
[src]
Append a reference to a definition.
fn extend<I>(&mut self, it: I) where
I: IntoIterator<Item = Element<'el, C>>,
[src]
I: IntoIterator<Item = Element<'el, C>>,
Extend with another set of tokens.
fn walk_custom(&self) -> WalkCustomIter<C>
[src]
Walk over all elements.
fn is_empty(&self) -> bool
[src]
Check if tokens contain no elements.
impl<'el, C: Custom> Tokens<'el, C>
[src]
fn format(
&self,
out: &mut Formatter,
extra: &mut C::Extra,
level: usize
) -> Result
[src]
&self,
out: &mut Formatter,
extra: &mut C::Extra,
level: usize
) -> Result
Format the tokens.
fn to_file(self) -> Result<String, Error>
[src]
Format token as file.
fn to_file_with(self, extra: C::Extra) -> Result<String, Error>
[src]
Format token as file with the given extra.
fn to_string(self) -> Result<String, Error>
[src]
Format the tokens.
fn to_string_with(self, extra: C::Extra) -> Result<String, Error>
[src]
Format the tokens with the given extra.
impl<'el, C: Clone> Tokens<'el, C>
[src]
Methods only available for clonable elements.
fn join<E>(self, element: E) -> Tokens<'el, C> where
E: Into<Element<'el, C>>,
[src]
E: Into<Element<'el, C>>,
Join the set of tokens on the given element.
fn join_spacing(self) -> Tokens<'el, C>
[src]
Join with spacing.
fn join_line_spacing(self) -> Tokens<'el, C>
[src]
Join with line spacing.
Trait Implementations
impl<'el, C: Debug + 'el> Debug for Tokens<'el, C>
[src]
impl<'el, C: Clone + 'el> Clone for Tokens<'el, C>
[src]
fn clone(&self) -> Tokens<'el, C>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'el, C: Default + 'el> Default for Tokens<'el, C>
[src]
impl<'el, C: PartialEq + 'el> PartialEq for Tokens<'el, C>
[src]
fn eq(&self, __arg_0: &Tokens<'el, C>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Tokens<'el, C>) -> bool
[src]
This method tests for !=
.
impl<'el, C: Eq + 'el> Eq for Tokens<'el, C>
[src]
impl<'el, C> IntoIterator for Tokens<'el, C>
[src]
type Item = Element<'el, C>
The type of the elements being iterated over.
type IntoIter = IntoIter<Element<'el, C>>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl<'el, C> IntoTokens<'el, C> for Tokens<'el, C>
[src]
fn into_tokens(self) -> Tokens<'el, C>
[src]
Convert the type into tokens.
impl<'el, C> From<Vec<Tokens<'el, C>>> for Tokens<'el, C>
[src]
impl<'el, C> From<Element<'el, C>> for Tokens<'el, C>
[src]
impl<'el, C> From<&'el str> for Tokens<'el, C>
[src]
impl<'el, C> From<String> for Tokens<'el, C>
[src]
impl<'el, C> FromIterator<&'el Element<'el, C>> for Tokens<'el, C>
[src]
fn from_iter<I: IntoIterator<Item = &'el Element<'el, C>>>(
iter: I
) -> Tokens<'el, C>
[src]
iter: I
) -> Tokens<'el, C>
Creates a value from an iterator. Read more
impl<'el, C> FromIterator<Element<'el, C>> for Tokens<'el, C>
[src]
fn from_iter<I: IntoIterator<Item = Element<'el, C>>>(iter: I) -> Tokens<'el, C>
[src]
Creates a value from an iterator. Read more
impl<'el> From<(Cons<'el>, Constructor<'el>)> for Tokens<'el, Java<'el>>
[src]
fn from(value: (Cons<'el>, Constructor<'el>)) -> Tokens<'el, Java<'el>>
[src]
Performs the conversion.
impl<'el> From<Field<'el>> for Tokens<'el, Java<'el>>
[src]
impl<'el, C: Custom> From<Vec<Modifier>> for Tokens<'el, C>
[src]
impl<'el> From<Argument<'el>> for Tokens<'el, Java<'el>>
[src]
impl<'el> From<Method<'el>> for Tokens<'el, Java<'el>>
[src]
impl<'el> From<Class<'el>> for Tokens<'el, Java<'el>>
[src]
impl<'el> From<Enum<'el>> for Tokens<'el, Java<'el>>
[src]
impl<'el> From<Interface<'el>> for Tokens<'el, Java<'el>>
[src]
impl<'el> From<Java<'el>> for Tokens<'el, Java<'el>>
[src]
impl<'el> From<&'el Java<'el>> for Tokens<'el, Java<'el>>
[src]
impl<'el> From<JavaScript<'el>> for Tokens<'el, JavaScript<'el>>
[src]
fn from(value: JavaScript<'el>) -> Tokens<'el, JavaScript<'el>>
[src]
Performs the conversion.
impl<'el> From<&'el JavaScript<'el>> for Tokens<'el, JavaScript<'el>>
[src]
fn from(value: &'el JavaScript<'el>) -> Tokens<'el, JavaScript<'el>>
[src]
Performs the conversion.