Struct python_ast::slice::TkSlice
[−]
[src]
pub struct TkSlice<'a>(pub &'a [Tk<'a>]);
Methods
impl<'a> TkSlice<'a>
[src]
fn iter(&self) -> Iter<Tk<'a>>
fn len(&self) -> usize
fn as_token(&self) -> Tk<'a>
Convert the slice back into a token assuming it is a slice of exactly len 1.
fn as_owned_token(&self) -> OwnedTk
Convert the slice back into a token assuming it is a slice of exactly len 1.
fn tokens(&self) -> &'a [Tk<'a>]
fn as_owned_tokens(&self) -> Vec<OwnedTk>
fn as_string(&self) -> String
Convert a token slice to a string
Trait Implementations
impl<'a> Clone for TkSlice<'a>
[src]
fn clone(&self) -> TkSlice<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a> Debug for TkSlice<'a>
[src]
impl<'a> Copy for TkSlice<'a>
[src]
impl<'a> Ord for TkSlice<'a>
[src]
fn cmp(&self, __arg_0: &TkSlice<'a>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<'a> Eq for TkSlice<'a>
[src]
impl<'a> PartialEq for TkSlice<'a>
[src]
fn eq(&self, __arg_0: &TkSlice<'a>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &TkSlice<'a>) -> bool
This method tests for !=
.
impl<'a> InputLength for TkSlice<'a>
[src]
fn input_len(&self) -> usize
calculates the input length, as indicated by its name, and the name of the trait itself Read more
impl<'a> Slice<Range<usize>> for TkSlice<'a>
[src]
impl<'a> Slice<RangeTo<usize>> for TkSlice<'a>
[src]
impl<'a> Slice<RangeFrom<usize>> for TkSlice<'a>
[src]
impl<'a> Slice<RangeFull> for TkSlice<'a>
[src]
impl<'a, 'b> Compare<&'b [Id]> for TkSlice<'a>
[src]
fn compare(&self, t: &'b [Id]) -> CompareResult
compares self to another value for equality
fn compare_no_case(&self, t: &'b [Id]) -> CompareResult
compares self to another value for equality independently of the case. Read more
impl<'a> PartialOrd for TkSlice<'a>
[src]
fn partial_cmp(&self, other: &TkSlice) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<'a> InputIter for TkSlice<'a>
[src]
type Item = &'a Tk<'a>
type RawItem = Id
type Iter = Enumerate<Iter<'a, Tk<'a>>>
type IterElem = Iter<'a, Tk<'a>>
fn iter_indices(&self) -> Self::Iter
returns an iterator over the elements and their byte offsets
fn iter_elements(&self) -> Self::IterElem
returns an iterator over the elements
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::RawItem) -> bool,
P: Fn(Self::RawItem) -> bool,
finds the byte position of the element
fn slice_index(&self, count: usize) -> Option<usize>
get the byte offset from the element's position in the stream