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
impl UncasedStr
pub fn new(string: &str) -> &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
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>
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>
impl<'a> AsRef<UncasedStr> for Uncased<'a>
§fn as_ref(&self) -> &UncasedStr
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>
impl<'a> Borrow<UncasedStr> for Uncased<'a>
§fn borrow(&self) -> &UncasedStr
fn borrow(&self) -> &UncasedStr
Immutably borrows from an owned value. Read more
§impl Debug for UncasedStr
impl Debug for UncasedStr
§impl Display for UncasedStr
impl Display for UncasedStr
§impl<'a> From<&'a str> for &'a UncasedStr
impl<'a> From<&'a str> for &'a UncasedStr
§fn from(string: &'a str) -> &'a UncasedStr
fn from(string: &'a str) -> &'a UncasedStr
Converts to this type from the input type.
§impl Hash for UncasedStr
impl Hash for UncasedStr
§impl Ord for UncasedStr
impl Ord for UncasedStr
§impl<'a> PartialEq<&'a str> for UncasedStr
impl<'a> PartialEq<&'a str> for UncasedStr
§impl<'a> PartialEq<UncasedStr> for &'a str
impl<'a> PartialEq<UncasedStr> for &'a str
§impl PartialEq<UncasedStr> for str
impl PartialEq<UncasedStr> for str
§impl PartialEq<str> for UncasedStr
impl PartialEq<str> for UncasedStr
§impl PartialEq for UncasedStr
impl PartialEq for UncasedStr
§impl PartialOrd for UncasedStr
impl PartialOrd for UncasedStr
impl Eq for UncasedStr
Auto Trait Implementations§
impl Freeze for UncasedStr
impl RefUnwindSafe for UncasedStr
impl Send for UncasedStr
impl !Sized for UncasedStr
impl Sync for UncasedStr
impl Unpin for UncasedStr
impl UnwindSafe for UncasedStr
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.