Skip to main content

BoxDict

Struct BoxDict 

Source
pub struct BoxDict { /* private fields */ }
Expand description

This is a runtime generated, owned Dict with string slices out of some backing store. These slices may come from a Vec<String>, or else from slices out of a single String.

Implementations§

Source§

impl BoxDict

Source

pub fn from_lines(backing: impl Into<Box<str>>) -> Self

Construct a dictionary from a single string slice, taking each non-empty line, with leading and trailing whitespace trimmed, as a single word.

Source

pub fn from_sep(backing: impl Into<Box<str>>, sep: &str) -> Self

Construct a dictionary from a single string slice, with fields separated by a separator. Individual words are not trimmed.

Trait Implementations§

Source§

impl Debug for BoxDict

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Deref for BoxDict

Source§

type Target = dyn Dict

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Dict for BoxDict

Source§

fn len(&self) -> usize

Returns the number of words in the list.
Source§

fn word(&self, i: usize) -> &str

Return the ith word in the list.
Source§

fn hash(&self) -> &[u8; 32]

Return the unique BLAKE2b256 hash of this word list.
Source§

fn is_empty(&self) -> bool

Returns true iff the word list is empty.
Source§

impl Eq for BoxDict

Source§

impl<S: AsRef<str>> FromIterator<S> for BoxDict

Source§

fn from_iter<T: IntoIterator<Item = S>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl Hash for BoxDict

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BoxDict

Source§

fn eq(&self, other: &BoxDict) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BoxDict

Auto Trait Implementations§

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.