Struct figment::value::UncasedStr [−][src]
A cost-free reference to an uncased (case-insensitive, case-preserving) ASCII string.
This is typically created from an &str as follows:
use uncased::UncasedStr; let ascii_ref: &UncasedStr = "Hello, world!".into();
Implementations
impl UncasedStr[src]
pub fn new(string: &str) -> &UncasedStr[src]
Cost-free conversion from an &str reference to an UncasedStr.
Example
use 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 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"));
pub fn into_uncased(self: Box<UncasedStr, Global>) -> Uncased<'static>[src]
This is supported on crate feature
alloc only.Converts a Box<UncasedStr> into an Uncased without copying or
allocating.
Example
use uncased::Uncased; let uncased = Uncased::new("Hello!"); let boxed = uncased.clone().into_boxed_uncased(); assert_eq!(boxed.into_uncased(), uncased);
Trait Implementations
impl<'_> AsRef<UncasedStr> for Uncased<'_>[src]
pub fn as_ref(&self) -> &UncasedStr[src]
impl<'_> Borrow<UncasedStr> for Uncased<'_>[src]
pub fn borrow(&self) -> &UncasedStr[src]
impl Debug for UncasedStr[src]
impl Display for UncasedStr[src]
impl Eq for UncasedStr[src]
impl<'a> From<&'a str> for &'a UncasedStr[src]
pub fn from(string: &'a str) -> &'a UncasedStr[src]
impl<'s, 'c> From<&'c UncasedStr> for Uncased<'s> where
'c: 's, [src]
'c: 's,
pub fn from(string: &'c UncasedStr) -> Uncased<'s>[src]
impl Hash for UncasedStr[src]
pub fn hash<H>(&self, hasher: &mut H) where
H: Hasher, [src]
H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl<I> Index<I> for UncasedStr where
I: SliceIndex<str, Output = str>, [src]
I: SliceIndex<str, Output = str>,
type Output = UncasedStr
The returned type after indexing.