Text

Struct Text 

Source
pub struct Text<C, T>
where C: Character, T: AsRef<[C]>,
{ /* private fields */ }
Expand description

A text structure used as the target for pattern searching in the index.

Not only does it contain the text, but also the maximum character value in the text. This is used to determine the number of bits needed to store the characters in the text.

Implementations§

Source§

impl<C, T> Text<C, T>
where C: Character + Bounded, T: AsRef<[C]>,

Source

pub fn new(text: T) -> Self

Create a new text structure with the given text.

The maximum character value is set to the maximum value of the character type.

Source§

impl<C, T> Text<C, T>
where C: Character, T: AsRef<[C]>,

Source

pub fn with_max_character(text: T, max_character: C) -> Self

Create a new text structure with the given text and the largest character value.

This is used when the maximum character value is known in advance.

Source

pub fn text(&self) -> &[C]

Get the text as a slice.

Source

pub fn max_character(&self) -> C

Return the maximum character value in the text.

Auto Trait Implementations§

§

impl<C, T> Freeze for Text<C, T>
where T: Freeze, C: Freeze,

§

impl<C, T> RefUnwindSafe for Text<C, T>

§

impl<C, T> Send for Text<C, T>
where T: Send, C: Send,

§

impl<C, T> Sync for Text<C, T>
where T: Sync, C: Sync,

§

impl<C, T> Unpin for Text<C, T>
where T: Unpin, C: Unpin,

§

impl<C, T> UnwindSafe for Text<C, T>
where T: UnwindSafe, C: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.