Struct CharSearcher

pub struct CharSearcher<'a> { pub(in ::str::pattern) haystack: &'a str, pub(in ::str::pattern) finger: usize, pub(in ::str::pattern) finger_back: usize, pub(in ::str::pattern) needle: char, pub(in ::str::pattern) utf8_size: u8, pub(in ::str::pattern) utf8_encoded: [u8; 4] }

Associated type for <char as Pattern>::Searcher<'a>.

Fields

haystack: &'a str
finger: usize

finger is the current byte index of the forward search. Imagine that it exists before the byte at its index, i.e. haystack[finger] is the first byte of the slice we must inspect during forward searching

finger_back: usize

finger_back is the current byte index of the reverse search. Imagine that it exists after the byte at its index, i.e. haystack[finger_back - 1] is the last byte of the slice we must inspect during forward searching (and thus the first byte to be inspected when calling next_back()).

needle: char

The character being searched for

utf8_size: u8

The number of bytes needle takes up when encoded in utf8.

utf8_encoded: [u8; 4]

A utf8 encoded copy of the needle

Implementations

impl CharSearcher<'_>

fn utf8_size(&self) -> usize

Trait Implementations

impl<'a> Clone for CharSearcher<'a>

fn clone(&self) -> CharSearcher<'a>

impl<'a> Debug for CharSearcher<'a>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<'a> DoubleEndedSearcher<'a> for CharSearcher<'a>

impl<'a> ReverseSearcher<'a> for CharSearcher<'a>

fn next_back(&mut self) -> SearchStep
fn next_match_back(&mut self) -> Option<(usize, usize)>

impl<'a> Searcher<'a> for CharSearcher<'a>

fn haystack(&self) -> &'a str
fn next(&mut self) -> SearchStep
fn next_match(&mut self) -> Option<(usize, usize)>

Auto Trait Implementations

impl<'a> Freeze for CharSearcher<'a>

impl<'a> RefUnwindSafe for CharSearcher<'a>

impl<'a> Send for CharSearcher<'a>

impl<'a> Sync for CharSearcher<'a>

impl<'a> Unpin for CharSearcher<'a>

impl<'a> UnsafeUnpin for CharSearcher<'a>

impl<'a> UnwindSafe for CharSearcher<'a>

Blanket Implementations

impl<T> Any for CharSearcher<'a> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for CharSearcher<'a> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for CharSearcher<'a> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for CharSearcher<'a> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for CharSearcher<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for CharSearcher<'a> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for CharSearcher<'a>

impl<T, U> Into<U> for CharSearcher<'a> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for CharSearcher<'a> where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for CharSearcher<'a> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>