Struct figment::value::Uncased[][src]

pub struct Uncased<'s> { /* fields omitted */ }
This is supported on crate feature 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]

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 as_uncased_str(&self) -> &UncasedStr[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_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, Global>[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"));

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

impl<'_> AsRef<[u8]> for Uncased<'_>[src]

impl<'_> AsRef<UncasedStr> for Uncased<'_>[src]

impl<'_> AsRef<str> for Uncased<'_>[src]

impl<'_> Borrow<UncasedStr> for Uncased<'_>[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.

impl<'_> Display for Uncased<'_>[src]

impl<'_> Eq for Uncased<'_>[src]

impl<'s, 'c> From<&'c UncasedStr> for Uncased<'s> where
    'c: 's, 
[src]

impl<'s, 'c> From<&'c str> for Uncased<'s> where
    'c: 's, 
[src]

impl<'s, 'c> From<Cow<'c, str>> for Uncased<'s> where
    'c: 's, 
[src]

impl From<String> for Uncased<'static>[src]

impl<'_> Hash for Uncased<'_>[src]

impl<'_> Ord for Uncased<'_>[src]

impl<'_, '_> PartialEq<&'_ str> for Uncased<'_>[src]

impl<'_, '_> PartialEq<String> for &'_ Uncased<'_>[src]

impl<'_> PartialEq<String> for Uncased<'_>[src]

impl<'_, '_> PartialEq<Uncased<'_>> for Uncased<'_>[src]

impl<'_> PartialEq<str> for Uncased<'_>[src]

impl<'_, '_> PartialOrd<String> for &'_ Uncased<'_>[src]

impl<'_> PartialOrd<String> for Uncased<'_>[src]

impl<'_, '_> PartialOrd<Uncased<'_>> for Uncased<'_>[src]

impl<'_> PartialOrd<str> 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]

impl<T> AsUncased for T where
    T: AsRef<str> + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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