Struct rocket::http::uncased::UncasedStr

#[repr(C)]
pub struct UncasedStr(/* private fields */);
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

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

§

fn as_ref(&self) -> &UncasedStr

Converts this type into a shared reference of the (usually inferred) input type.
§

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

§

fn borrow(&self) -> &UncasedStr

Immutably borrows from an owned value. Read more
§

impl Debug for UncasedStr

§

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

Formats the value using the given formatter. Read more
§

impl Display for UncasedStr

§

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

Formats the value using the given formatter. Read more
§

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

§

fn from(string: &'a str) -> &'a UncasedStr

Converts to this type from the input type.
§

impl Hash for UncasedStr

§

fn hash<H>(&self, hasher: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
§

impl Ord for UncasedStr

§

fn cmp(&self, other: &UncasedStr) -> Ordering

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

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

§

fn eq(&self, other: &&'a str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

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

§

fn eq(&self, other: &UncasedStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<UncasedStr> for str

§

fn eq(&self, other: &UncasedStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<str> for UncasedStr

§

fn eq(&self, other: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq for UncasedStr

§

fn eq(&self, other: &UncasedStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialOrd for UncasedStr

§

fn partial_cmp(&self, other: &UncasedStr) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

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

impl Eq for UncasedStr

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

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

source§

fn equivalent(&self, key: &K) -> bool

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

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more