Struct figment::value::Uncased [−][src]
pub struct Uncased<'s> { /* fields omitted */ }
alloc
only.Expand description
An uncased (case-insensitive, case-preserving), owned or borrowed ASCII string.
Implementations
Creates a new Uncased
string from string
without allocating.
Example
use uncased::Uncased; let uncased = Uncased::new("Content-Type"); assert_eq!(uncased, "content-type"); assert_eq!(uncased, "CONTENT-Type");
Creates a new Uncased
string from a borrowed string
.
Example
use uncased::Uncased; const UNCASED: Uncased = Uncased::from_borrowed("Content-Type"); assert_eq!(UNCASED, "content-type"); assert_eq!(UNCASED, "CONTENT-Type");
Creates a new Uncased
string from string
without allocating.
Example
use uncased::Uncased; const UNCASED: Uncased = Uncased::from_owned(String::new()); let uncased = Uncased::from_owned("Content-Type".to_string()); assert_eq!(uncased, "content-type"); assert_eq!(uncased, "CONTENT-Type");
Converts self
into an owned Uncased<'static>
, allocating if
necessary.
Example
use uncased::Uncased; let foo = "foo".to_string(); let uncased = Uncased::from(foo.as_str()); let owned: Uncased<'static> = uncased.into_owned(); assert_eq!(owned, "foo");
Converts self
into an owned String
, allocating if necessary.
Example
use uncased::Uncased; let uncased = Uncased::new("Content-Type"); let string = uncased.into_string(); assert_eq!(string, "Content-Type".to_string());
Converts self
into an owned Uncased<'static>
, allocating if
necessary.
Example
use uncased::Uncased; let foo = "foo".to_string(); let uncased = Uncased::from(foo.as_str()); let owned: Uncased<'static> = uncased.into_owned(); assert_eq!(owned, "foo");
Converts self
into a Box<UncasedStr>
.
Example
use uncased::Uncased; let boxed = Uncased::new("Content-Type").into_boxed_uncased(); assert_eq!(&*boxed, "content-type");
Methods from Deref<Target = UncasedStr>
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"));
Trait Implementations
Performs the conversion.
Immutably borrows from an owned value. Read more
type Target = UncasedStr
type Target = UncasedStr
The resulting type after dereferencing.
Dereferences the value.
Performs the conversion.
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
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<'s> RefUnwindSafe for Uncased<'s>
impl<'s> UnwindSafe for Uncased<'s>
Blanket Implementations
Convert self
to an UncasedStr
.
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V