[]Struct rocket::http::uncased::UncasedStr

#[repr(C)]
pub struct UncasedStr(_);

A reference to an uncased (case-preserving) ASCII string. This is typically created from an &str as follows:

use rocket::http::uncased::UncasedStr;

let ascii_ref: &UncasedStr = "Hello, world!".into();

Methods

impl UncasedStr

pub fn new(string: &str) -> &UncasedStr

Returns a reference to an UncasedStr from an &str.

Example

use rocket::http::uncased::UncasedStr;

let uncased_str = UncasedStr::new("Hello!");
assert_eq!(uncased_str, "hello!");
assert_eq!(uncased_str, "Hello!");
assert_eq!(uncased_str, "HeLLo!");

pub fn as_str(&self) -> &str

Returns self as an &str.

Example

use rocket::http::uncased::UncasedStr;

let uncased_str = UncasedStr::new("Hello!");
assert_eq!(uncased_str.as_str(), "Hello!");
assert_ne!(uncased_str.as_str(), "hELLo!");

pub fn into_uncased(self: Box<UncasedStr>) -> Uncased<'static>

Converts a Box<UncasedStr> into an Uncased without copying or allocating.

Example

use rocket::http::uncased::Uncased;

let uncased = Uncased::new("Hello!");
let boxed = uncased.clone().into_boxed_uncased();
assert_eq!(boxed.into_uncased(), uncased);

Trait Implementations

impl Eq for UncasedStr

impl<'a> PartialEq<&'a str> for UncasedStr

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl<'a> PartialEq<UncasedStr> for &'a str

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl PartialEq<str> for UncasedStr

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl PartialEq<UncasedStr> for str

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl PartialEq<UncasedStr> for UncasedStr

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl Display for UncasedStr

impl PartialOrd<UncasedStr> for UncasedStr

#[must_use] fn lt(&self, other: &Rhs) -> bool1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use] fn le(&self, other: &Rhs) -> bool1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use] fn gt(&self, other: &Rhs) -> bool1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use] fn ge(&self, other: &Rhs) -> bool1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Hash for UncasedStr

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Ord for UncasedStr

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl<'a> AsRef<UncasedStr> for Uncased<'a>

impl Debug for UncasedStr

impl<'a> From<&'a str> for &'a UncasedStr

impl<'a> Borrow<UncasedStr> for Uncased<'a>

Auto Trait Implementations

impl Send for UncasedStr

impl Sync for UncasedStr

impl Unpin for UncasedStr

impl UnwindSafe for UncasedStr

impl RefUnwindSafe for UncasedStr

Blanket Implementations

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

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]