Struct hayagriva::lang::TitleCase

source ·
#[non_exhaustive]
pub struct TitleCase { pub always_capitalize_after_punctuation: bool, pub always_capitalize_last_word: bool, pub always_capitalize_min_len: Option<usize>, pub hyphen_word_separator: bool, pub keep_all_uppercase_words: bool, pub use_exception_dictionary: bool, pub trim_start: bool, pub trim_end: bool, }
Expand description

Rules for the title case transformation.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§always_capitalize_after_punctuation: bool

Always capitalize after a full stop, question or exclamation mark, and colon even if the punctuation is followed by a word on the capitalization blacklist.

§always_capitalize_last_word: bool

Always capitalize the last word of the title, even if it is on the capitalization blacklist.

§always_capitalize_min_len: Option<usize>

Always capitalize a word matching or exceeding a certain length, even if it is on the capitalization blacklist.

§hyphen_word_separator: bool

Treat the hyphen as a word separator, i. e. capitalize in hyphenated expressions.

§keep_all_uppercase_words: bool

Do not touch all-uppercase words like “USA” if the title contains lower-case characters at all.

§use_exception_dictionary: bool

Enable usage of the capitalization blacklist.

§trim_start: bool

Discard whitespace at the start of the title.

§trim_end: bool

Discard whitespace at the end of the title.

Implementations§

source§

impl TitleCase

source

pub fn new() -> Self

Construct TitleCaseProperties with the default values.

Trait Implementations§

source§

impl Clone for TitleCase

source§

fn clone(&self) -> TitleCase

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 TitleCase

source§

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

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

impl Default for TitleCase

source§

fn default() -> Self

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

impl From<TitleCase> for Case

source§

fn from(props: TitleCase) -> Self

Converts to this type from the input type.
source§

impl PartialEq for TitleCase

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for TitleCase

source§

impl Eq for TitleCase

source§

impl StructuralPartialEq for TitleCase

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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,

§

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

§

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

§

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.