hayagriva::lang

Struct CaseFolder

source
pub struct CaseFolder { /* private fields */ }
Expand description

Buffer that adjusts word case on the fly.

Implementations§

source§

impl CaseFolder

source

pub fn new() -> Self

Create a new case folder.

source

pub fn with_config(case: Case) -> Self

Create a case folder with a case configuration.

source

pub fn push_str(&mut self, s: &str)

Add a string to the buffer.

source

pub fn prevent_trimming(&mut self)

Prevent whitespace trimming before and after the current position.

source

pub fn push_verbatim(&mut self, value: &str)

Add a string chunk to the buffer.

source

pub fn push_chunk(&mut self, chunk: &FoldableStringChunk)

Add a string chunk to the buffer.

source

pub fn push(&mut self, c: char)

Add a character to the buffer.

source

pub fn case(&self) -> Case

Retrieve the configuration of the CaseFolder.

source

pub fn reconfigure(&mut self, case: Case)

Change the configuration of the CaseFolder.

source

pub fn finish(self) -> String

Yield the transformed string.

source

pub fn is_empty(&self) -> bool

Whether the buffer is empty.

source

pub fn len(&self) -> usize

Return the length of the buffer.

source

pub fn has_content(&self) -> bool

Whether the buffer contains only whitespace.

source

pub fn ends_with(&self, pattern: char) -> bool

Check if the buffer ends with a character.

source

pub fn mark_changed(&mut self)

Notify the struct that an outside manipulation to the underlying buffer occurred.

Trait Implementations§

source§

impl Clone for CaseFolder

source§

fn clone(&self) -> CaseFolder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CaseFolder

source§

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

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

impl Default for CaseFolder

source§

fn default() -> Self

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

impl Write for CaseFolder

source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
source§

fn write_char(&mut self, c: char) -> Result

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. 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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.