[][src]Struct join_impl::expr_chain::group::GroupDeterminer

pub struct GroupDeterminer { /* fields omitted */ }

GroupDeterminer is used to determine any CommandGroup or separator (for ex. ,) in ParseStream

Methods

impl GroupDeterminer[src]

pub const fn new_const(
    group_type: Option<CommandGroup>,
    check_input_fn: *const (),
    validate_parsed: bool,
    length: u8
) -> Self
[src]

Constructs new GroupDeterminer using const fn (can be used to create const or static item).

Example:

extern crate join_impl;
extern crate syn;

use syn::Token;
use syn::parse::ParseStream;
use join_impl::expr_chain::group::GroupDeterminer;

fn check_input(input: ParseStream) -> bool { input.peek(Token![,]) }

fn main() {
    let first_comma_determiner = GroupDeterminer::new_const(
        None, // Because comma is not a command group
        check_input as *const (),
        false,
        1
    );
}

pub fn new(
    group_type: impl Into<Option<CommandGroup>>,
    check_input_fn: CheckStreamFn,
    validate_parsed: bool,
    length: u8
) -> Self
[src]

Constructs new GroupDeterminer.

Example:

extern crate join_impl;
extern crate syn;

use syn::Token;
use syn::parse::ParseStream;
use join_impl::expr_chain::group::GroupDeterminer;

fn check_input(input: ParseStream) -> bool { input.peek(Token![,]) }

fn main() {
    let first_comma_determiner = GroupDeterminer::new(
        None, // Because comma is not a command group
        check_input,
        false,
        1
    );
}

pub fn get_group_type(&self) -> Option<CommandGroup>[src]

Returns type of group of GroupDeterminer.

pub fn check_input(&self, input: ParseStream) -> bool[src]

Checks if input next tokens are of self group type.

pub fn check_parsed<T: Parse>(&self, input: TokenStream) -> bool[src]

Checks already parsed tokens. In many cases it's used to check if parsed tokens are valid expression. in this case we can say for sure that we found separator.

pub fn erase_input<'b>(&self, input: ParseStream<'b>) -> Result<ParseStream<'b>>[src]

Used to parse length tokens of type TokenTree from input ParseStream.

pub fn length(&self) -> u8[src]

Returns value of length field.

Trait Implementations

impl Clone for GroupDeterminer[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]