[−][src]Struct figment::value::Uncased
alloc
only.An uncased (case-insensitive, case-preserving), owned or borrowed ASCII string.
Implementations
impl<'s> Uncased<'s>
[src]
pub fn new<S>(string: S) -> Uncased<'s> where
S: Into<Cow<'s, str>>,
[src]
S: Into<Cow<'s, str>>,
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");
pub const fn from_borrowed(string: &'s str) -> Uncased<'s>
[src]
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");
pub const fn from_owned(string: String) -> Uncased<'s>
[src]
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");
pub fn into_string(self) -> String
[src]
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());
pub fn into_owned(self) -> Uncased<'static>
[src]
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");
pub fn into_boxed_uncased(self) -> Box<UncasedStr>
[src]
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>
pub fn as_str(&self) -> &str
[src]
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!");
pub fn len(&self) -> usize
[src]
Returns the length, in bytes, of self
.
Example
use uncased::UncasedStr; let uncased_str = UncasedStr::new("Hello!"); assert_eq!(uncased_str.len(), 6);
pub fn starts_with(&self, string: &str) -> bool
[src]
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"));
Trait Implementations
impl<'_> AsRef<UncasedStr> for Uncased<'_>
[src]
pub fn as_ref(&self) -> &UncasedStr
[src]
impl<'_> Borrow<UncasedStr> for Uncased<'_>
[src]
pub fn borrow(&self) -> &UncasedStr
[src]
impl<'s> Clone for Uncased<'s>
[src]
impl<'s> Debug for Uncased<'s>
[src]
impl<'_> Deref for Uncased<'_>
[src]
type Target = UncasedStr
The resulting type after dereferencing.
pub fn deref(&self) -> &UncasedStr
[src]
impl<'_> Display for Uncased<'_>
[src]
impl<'_> Eq for Uncased<'_>
[src]
impl<'s, 'c> From<&'c UncasedStr> for Uncased<'s> where
'c: 's,
[src]
'c: 's,
pub fn from(string: &'c UncasedStr) -> Uncased<'s>
[src]
impl<'s, 'c> From<&'c str> for Uncased<'s> where
'c: 's,
[src]
'c: 's,
impl<'s, 'c> From<Cow<'c, str>> for Uncased<'s> where
'c: 's,
[src]
'c: 's,
impl From<String> for Uncased<'static>
[src]
impl<'_> Hash for Uncased<'_>
[src]
pub fn hash<H>(&self, hasher: &mut H) where
H: Hasher,
[src]
H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'_> Ord for Uncased<'_>
[src]
pub fn cmp(&self, other: &Uncased<'_>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<'b, '_> PartialEq<&'b str> for Uncased<'_>
[src]
pub fn eq(&self, other: &&'b str) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'b, '_> PartialEq<Uncased<'b>> for Uncased<'_>
[src]
pub fn eq(&self, other: &Uncased<'b>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialEq<str> for Uncased<'_>
[src]
impl<'b, '_> PartialOrd<Uncased<'b>> for Uncased<'_>
[src]
Auto Trait Implementations
impl<'s> RefUnwindSafe for Uncased<'s>
impl<'s> Send for Uncased<'s>
impl<'s> Sync for Uncased<'s>
impl<'s> Unpin for Uncased<'s>
impl<'s> UnwindSafe for Uncased<'s>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,