WordVec

Struct WordVec 

Source
pub struct WordVec(/* private fields */);
Expand description

A vector of words that is capped in size to 2^8 entries, is always sorted and contains no duplicate entries.

Implementations§

Source§

impl WordVec

Source

pub fn new( words: impl IntoIterator<Item = impl Into<String>>, ) -> Result<WordVec, OverflowError>

Creates a new vector from a given iterable of string-like words.

§Errors

OverflowError if this operation would result in a vector that exceeds 2^8 entries.

Source

pub fn push(&mut self, word: impl Into<String>) -> Result<(), OverflowError>

Appends a string-like word to the vector.

§Errors

OverflowError if this operation would result in a vector that exceeds 2^8 entries.

Trait Implementations§

Source§

impl AsRef<Vec<String>> for WordVec

Source§

fn as_ref(&self) -> &Vec<String>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'__de, __Context> BorrowDecode<'__de, __Context> for WordVec

Source§

fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given BorrowDecode.
Source§

impl Debug for WordVec

Source§

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

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

impl<__Context> Decode<__Context> for WordVec

Source§

fn decode<__D: Decoder<Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
Source§

impl Default for WordVec

Source§

fn default() -> WordVec

Returns the “default value” for a type. Read more
Source§

impl Encode for WordVec

Source§

fn encode<__E: Encoder>(&self, encoder: &mut __E) -> Result<(), EncodeError>

Encode a given type.
Source§

impl From<WordVec> for Vec<String>

Source§

fn from(vec: WordVec) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for WordVec

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for WordVec

Source§

impl StructuralPartialEq for WordVec

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<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.