Skip to main content

UniCase

Struct UniCase 

Source
pub struct UniCase<S>(/* private fields */);
Expand description

Case Insensitive wrapper of strings.

Implementations§

Source§

impl<S> UniCase<S>
where S: AsRef<str>,

Source

pub fn new(s: S) -> UniCase<S>

Creates a new UniCase.

Note: This scans the text to determine if it is all ASCII or not.

Source

pub fn to_folded_case(&self) -> String

Returns a copy of this string where each character is mapped to its Unicode CaseFolding equivalent.

§Note

Unicode Case Folding is meant for string storage and matching, not for display.

Source§

impl<S> UniCase<S>

Source

pub const fn unicode(s: S) -> UniCase<S>

Creates a new UniCase, skipping the ASCII check.

Source

pub const fn ascii(s: S) -> UniCase<S>

Creates a new UniCase which performs only ASCII case folding.

Source

pub fn is_ascii(&self) -> bool

Return true if this instance will only perform ASCII case folding.

Source

pub fn into_inner(self) -> S

Unwraps the inner value held by this UniCase.

Trait Implementations§

Source§

impl<S> AsRef<str> for UniCase<S>
where S: AsRef<str>,

Source§

fn as_ref(&self) -> &str

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

impl<S> Clone for UniCase<S>
where S: Clone,

Source§

fn clone(&self) -> UniCase<S>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<S> Debug for UniCase<S>
where S: Debug,

Source§

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

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

impl<S> Default for UniCase<S>
where S: AsRef<str> + Default,

Source§

fn default() -> UniCase<S>

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

impl<S> Deref for UniCase<S>

Source§

type Target = S

The resulting type after dereferencing.
Source§

fn deref<'a>(&'a self) -> &'a S

Dereferences the value.
Source§

impl<S> DerefMut for UniCase<S>

Source§

fn deref_mut<'a>(&'a mut self) -> &'a mut S

Mutably dereferences the value.
Source§

impl<S> Display for UniCase<S>
where S: Display,

Source§

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

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

impl<'a> From<&'a String> for UniCase<&'a str>

Source§

fn from(s: &'a String) -> UniCase<&'a str>

Converts to this type from the input type.
Source§

impl<'a> From<&'a str> for UniCase<Cow<'a, str>>

Source§

fn from(s: &'a str) -> UniCase<Cow<'a, str>>

Converts to this type from the input type.
Source§

impl<'a> From<&'a str> for UniCase<String>

Source§

fn from(s: &'a str) -> UniCase<String>

Converts to this type from the input type.
Source§

impl<S> From<Ascii<S>> for UniCase<S>

Source§

fn from(ascii: Ascii<S>) -> UniCase<S>

Converts to this type from the input type.
Source§

impl<'a> From<Cow<'a, str>> for UniCase<String>

Source§

fn from(s: Cow<'a, str>) -> UniCase<String>

Converts to this type from the input type.
Source§

impl<S> From<S> for UniCase<S>
where S: AsRef<str>,

Source§

fn from(s: S) -> UniCase<S>

Converts to this type from the input type.
Source§

impl<'a> From<String> for UniCase<Cow<'a, str>>

Source§

fn from(s: String) -> UniCase<Cow<'a, str>>

Converts to this type from the input type.
Source§

impl<S> FromStr for UniCase<S>
where S: FromStr + AsRef<str>,

Source§

type Err = <S as FromStr>::Err

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<UniCase<S>, <UniCase<S> as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<S> Hash for UniCase<S>
where S: AsRef<str>,

Source§

fn hash<H>(&self, hasher: &mut H)
where H: Hasher,

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<'a> Into<&'a str> for UniCase<&'a str>

Source§

fn into(self) -> &'a str

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<Cow<'a, str>> for UniCase<Cow<'a, str>>

Source§

fn into(self) -> Cow<'a, str>

Converts this type into the (usually inferred) input type.
Source§

impl<'a> Into<String> for UniCase<String>

Source§

fn into(self) -> String

Converts this type into the (usually inferred) input type.
Source§

impl<T> Ord for UniCase<T>
where T: AsRef<str>,

Source§

fn cmp(&self, other: &UniCase<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<S1, S2> PartialEq<UniCase<S2>> for UniCase<S1>
where S1: AsRef<str>, S2: AsRef<str>,

Source§

fn eq(&self, other: &UniCase<S2>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<T> PartialOrd for UniCase<T>
where T: AsRef<str>,

Source§

fn partial_cmp(&self, other: &UniCase<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<S> Copy for UniCase<S>
where S: Copy,

Source§

impl<S> Eq for UniCase<S>
where S: AsRef<str>,

Auto Trait Implementations§

§

impl<S> Freeze for UniCase<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for UniCase<S>
where S: RefUnwindSafe,

§

impl<S> Send for UniCase<S>
where S: Send,

§

impl<S> Sync for UniCase<S>
where S: Sync,

§

impl<S> Unpin for UniCase<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for UniCase<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for UniCase<S>
where S: UnwindSafe,

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> AsUncased for T
where T: AsRef<str> + ?Sized,

Source§

fn as_uncased(&self) -> &UncasedStr

Convert self to an UncasedStr.
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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<T> DebugExt<T> for T
where T: Debug,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<A> DynCastExt for A

Source§

fn dyn_cast<T>( self, ) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source>
where A: DynCastExtHelper<T>, T: ?Sized,

Use this to cast from one trait object type to another. Read more
Source§

fn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target
where A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>, T: ?Sized,

Use this to upcast a trait to one of its supertraits. Read more
Source§

fn dyn_cast_adv<F, T>( self, ) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source>
where A: DynCastExtAdvHelper<F, T>, F: ?Sized, T: ?Sized,

Use this to cast from one trait object type to another. This method is more customizable than the dyn_cast method. Here you can also specify the “source” trait from which the cast is defined. This can for example allow using casts from a supertrait of the current trait object. Read more
Source§

fn dyn_cast_with_config<C>( self, ) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source>

Use this to cast from one trait object type to another. With this method the type parameter is a config type that uniquely specifies which cast should be preformed. 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<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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> OrdExt<T> for T
where T: Ord + Clone,

Source§

fn update_max(&mut self, new: &T)

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Formattable for T
where T: Deref, <T as Deref>::Target: Formattable,

Source§

impl<T> Parsable for T
where T: Deref, <T as Deref>::Target: Parsable,

Source§

impl<T> RuleType for T
where T: Copy + Debug + Eq + Hash + Ord,