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

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

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();

Implementations

impl UncasedStr[src]

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

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[src]

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, Global>) -> Uncased<'static>[src]

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<'a> AsRef<UncasedStr> for Uncased<'a>[src]

pub fn as_ref(&self) -> &UncasedStr[src]

Performs the conversion.

impl<'a> Borrow<UncasedStr> for Uncased<'a>[src]

pub fn borrow(&self) -> &UncasedStr[src]

Immutably borrows from an owned value. Read more

impl Debug for UncasedStr[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl Display for UncasedStr[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl<'a> From<&'a str> for &'a UncasedStr[src]

pub fn from(string: &'a str) -> &'a UncasedStr[src]

Performs the conversion.

impl Hash for UncasedStr[src]

pub fn hash<H>(&self, hasher: &mut H) where
    H: Hasher
[src]

Feeds this value into the given Hasher. Read more

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[src]

pub fn cmp(&self, other: &UncasedStr) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

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

Restrict a value to a certain interval. Read more

impl<'a> PartialEq<&'a str> for UncasedStr[src]

pub fn eq(&self, other: &&'a str) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'a> PartialEq<UncasedStr> for &'a str[src]

pub fn eq(&self, other: &UncasedStr) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialEq<UncasedStr> for UncasedStr[src]

pub fn eq(&self, other: &UncasedStr) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialEq<UncasedStr> for str[src]

pub fn eq(&self, other: &UncasedStr) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialEq<str> for UncasedStr[src]

pub fn eq(&self, other: &str) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialOrd<UncasedStr> for UncasedStr[src]

pub fn partial_cmp(&self, other: &UncasedStr) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.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) -> bool
1.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) -> bool
1.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) -> bool
1.0.0[src]

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

impl Eq for UncasedStr[src]

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn equivalent(&self, key: &K) -> bool[src]

Compare self to key and return true if they are equal.

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

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more