std::ascii

This module performs operations on ASCII strings.

The AsciiExt trait contains a number of useful string slice utilities for testing, as well as conversion to upper and lowercase.

Structs

  • pub struct EscapeDefault: Iterates over the escaped version of a byte
  • impl iterator for EscapeDefault
    • type Item = u8: Type of the elements iterated over
  • impl iterator for EscapeDefault functions
    • next(&mut self) -> Option<u8>: Advances the iterator and return the next value
    • size_hint(&self) -> (usize, Option<usize>): Returns the bounds on the remaining length of the iterator
    • count(self) -> usize: Returns the number of iterations
    • last(self) -> Option<Self::Item>: Returns the last element
    • nth(&mut self, n:usize) -> Option<Self::Item>: Returns the next element after the nth position
    • chain<U>(self, other:U) -> Chain<Self, U::IntoIterator> where U: IntoIterator<Item=Self::Item>: Takes two iterators and creates a new one over both in sequence
    • zip<U>(self, other: U) -> Zip<Self, U:IntoIterator> where U:IntoIterator: Takes two iterators and makes them into a single pair iterator
    • map<T,U>(self, u: U) -> Map<Self, U> where U:FnMut(Self::Item) -> T: Creates an iterator from a closure that calls that closure on each element
    • filter<F>(self, predicate: F) -> Filter<Self, F> where F: FnMut(&Self::Item) -> bool: Creates an iterator that uses a closure to determine whether an element should be returned
    • enumerate(self) -> Enumerate<Self>: Gives the current iteration count and the next value
    • peekable(self) -> Peekable<Self>: Peeks at the next value without the iterator consuming it
    • skip_while<P>(self, predicate:P) -> SkipWhile<Self, P> where P:FnMut(&Self::Item) -> bool: Creates an iterator that skips n elements based on the predicate.
    • take_while<P>(self, predicate:P) -> TakeWhile<Self, P> where P:FnMut(&Self::Item) -> bool: Creates an iterator that yields elements based on the predicate.
    • skip(self, n: usize) -> Skip<Self>: Skips the first n elements
    • take(self, n: usize) -> Take<Self>: The iterator that yields the first n elements
    • scan<S, T, U>(self, interal_state: S, u: U) -> Scan<Self, S, U> where U:FnMut(&mut S, Self::Item)-> Option<T>: The iterator adapter that holds an internal state and produces a new iterator
    • flat_map<T, U>(self, u:U) -> Flat_Map<Self, T, U> where U:FnMut(Self::Item) -> T, T:IntoIterator: Creates an iterator that works like a map, but produces a flattened, nested structure
    • fuse(self)->Fuse(Self): Iterator that terminates after the first instance of None
    • inspect<T>(self, t: T)->Insepect<Self, T> where T: FnMut(&self::Item)->(): Does something with each iterated element and passes the value on.
    • by_ref(&mut self) -> &mut Self: Borrows rather than consumes the iterator
    • collect<T>(self) -> T where T:FromIterator(Self::Item): Makes a collection from an iterator
    • partition<T, U>(self, u:U) -> (T,T) where T:Default + Extend<Self::Item>, U:FnMut(&Self::Item> -> bool: Takes the iterator and creates two collections from it
    • fold<T, U>(self, init:T, u:U)->T where U:FnMut(T, Self::Item) -> T: The iterator adapter that applies a function to produce a single final result
    • all<T>(&mut self, t:T) -> bool where T:FnMut(Self::Item) -> bool: Tests whether all elements of the iterator match the predicate T
    • any<T>(&mut self, t:T) -> bool where T:FnMut(Self::Item) -> bool: Tests whether any elements of the iterator match the predicate T
    • find<T>(&mut self, predicate:T) -> Option<Self::Item> where T: FnMut(&Self::Item) -> bool: Searches the iterator for a match to the predicate
    • position<T>(&mut self, predicate:T) -> Option<usize> where T:FnMut(Self::Item) -> bool: Searches the iterator for a match to the predicate and return the index
    • rposition<T>(&mut self, predicate:T) -> Option<usize> where T:FnMut(Self::Item) -> bool, Self:ExtractSizeIterator + doubleEndedIterator: As for position, except it searches from the right
    • max(self_ => Option<Self::Item>: Returns the max element of the iterator
    • min(self_ => Option<Self::Item>: Returns the min element of the iterator
    • rev(self) -> Rev<Self> where Self:DoubleEndedIterator: Reverses the direction of the iterator
    • unzip<T, U, FromT, FromU>(self) -> (FromT, FromU) -> Where FromT: Default + Extend<T>, FromU: Default + Extend<U>, Self::Iterator<Item=(T,U)>: Performs the reverse of ZIP (two collections from a single iterator)
    • cloned<'a, Y>(self) -> Cloned<Self> where Self:Iterator<Item = &'a T>, T: 'a + Clone: Creates an iterator that clones all of its elements
    • cycle(self) -> Cycle<Self> where Self:Clone: Repeats the iterator endlessly
    • sum<T>(self) -> T where Y:Add<Self::Item, Output=T> + Zero: Returns the sum of the iterator elements
    • Product<T>(self) -> T where T: Mul<Self::Item, Output = T> + One: Multiplies the elements of the iterator and returns the value
  • impl DoubleEndedIterator for EscapeDefault
    • next_back(&mut self) -> Option<u8>: Iterator able to yield a result from both ends
  • impl ExactSizeIterator for EscapeDefault
    • Len(&self) -> usize: Returns the number of times the iterator will iterate.

Traits

pub trait AsciiExt {
type Owned;
fn is_ascii(&self) -> bool ;
fn to_ascii_uppercase(&self) -> Self:: Owned ;
fn to_ascii_lowercase(&self) -> Self:: Owned ;
fn eq_ignore_ascii_case(&self, other: &Self) -> bool ;
fn make_ascii_uppercase(&mut self);
fn make_ascii_lowercase(&mut self);
}

The following are extension methods for ASCII subset operations on string slices:

  • Associated type
    • Owned: Container for copied ASCII characters.
  • Required methods
    • is_ascii(&self) -> bool: Whether value is an ASCII value
    • to_ascii_uppercase(&self) -> Self::Owned: Makes a copy of the string in ASCII uppercase
    • to_ascii_lowercase(&self) -> Self::Owned: As for uppercase, but in lowercase
    • eq_ignore_ascii_case(&self, other: &Self) -> bool: Are two strings the same ignoring the case
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset