Skip to main content

TrimSet

Struct TrimSet 

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

The characters a trim takes off, in the form the loop wants them.

The set is written once in a statement and asked about once a character, so it is worth preparing. The plain characters become a bitmask, one bit each, which is the whole test for the sets almost every statement writes: a space, or a handful of punctuation. Any character past ASCII is kept as the bytes it is written as, and matching is then a comparison of bytes rather than a decode.

Bytes are enough because of what UTF-8 is. A byte below 128 is always a whole character and never part of a longer one, and the encoding of a character is never the front or the back of another character’s encoding, so a match on bytes is a match on characters and no member of the set can be found halfway through something else.

Implementations§

Source§

impl TrimSet

Source

pub fn new(chars: &str) -> Self

The set a statement wrote, prepared.

Source

pub fn is_empty(&self) -> bool

Whether the set has anything in it. An empty one trims nothing, which is the answer the row engine gives too.

Trait Implementations§

Source§

impl Debug for TrimSet

Source§

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

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

impl Default for TrimSet

Source§

fn default() -> Self

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

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.