Struct figment::value::UncasedStr [−][src]
#[repr(transparent)]pub struct UncasedStr(_);
Expand description
A cost-free reference to an uncased (case-insensitive, case-preserving) ASCII string.
This is typically created from an &str
as follows:
use uncased::UncasedStr; let ascii_ref: &UncasedStr = "Hello, world!".into();
Implementations
Cost-free conversion from an &str
reference to an UncasedStr
.
Example
use uncased::UncasedStr; let uncased_str = UncasedStr::new("Hello!"); assert_eq!(uncased_str, "hello!"); assert_eq!(uncased_str, "Hello!"); assert_eq!(uncased_str, "HeLLo!");
Returns self
as an &str
.
Example
use uncased::UncasedStr; let uncased_str = UncasedStr::new("Hello!"); assert_eq!(uncased_str.as_str(), "Hello!"); assert_ne!(uncased_str.as_str(), "hELLo!");
Returns the length, in bytes, of self
.
Example
use uncased::UncasedStr; let uncased_str = UncasedStr::new("Hello!"); assert_eq!(uncased_str.len(), 6);
Returns true
if self
has a length of zero bytes.
Examples
use uncased::UncasedStr; let s = UncasedStr::new(""); assert!(s.is_empty()); let s = UncasedStr::new("not empty"); assert!(!s.is_empty());
Returns true
if self
starts with any casing of the string string
;
otherwise, returns false
.
Example
use uncased::UncasedStr; let uncased_str = UncasedStr::new("MoOO"); assert!(uncased_str.starts_with("moo")); assert!(uncased_str.starts_with("MOO")); assert!(uncased_str.starts_with("MOOO")); assert!(!uncased_str.starts_with("boo")); let uncased_str = UncasedStr::new("Bèe"); assert!(!uncased_str.starts_with("Be")); assert!(uncased_str.starts_with("Bè")); assert!(uncased_str.starts_with("Bè")); assert!(uncased_str.starts_with("bèe")); assert!(uncased_str.starts_with("BèE"));
This is supported on crate feature alloc
only.
alloc
only.Converts a Box<UncasedStr>
into an Uncased
without copying or
allocating.
Example
use uncased::Uncased; let uncased = Uncased::new("Hello!"); let boxed = uncased.clone().into_boxed_uncased(); assert_eq!(boxed.into_uncased(), uncased);
Trait Implementations
Performs the conversion.
Immutably borrows from an owned value. Read more
Performs the conversion.
Performs the conversion.
type Output = UncasedStr
type Output = UncasedStr
The returned type after indexing.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for UncasedStr
impl Send for UncasedStr
impl !Sized for UncasedStr
impl Sync for UncasedStr
impl Unpin for UncasedStr
impl UnwindSafe for UncasedStr