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")); let uncased_str = UncasedStr::new("Bèe"); assert!(!uncased_str.starts_with("Be")); assert!(uncased_str.starts_with("Bè")); assert!(uncased_str.starts_with("Bè")); assert!(uncased_str.starts_with("bèe")); assert!(uncased_str.starts_with("BèE"));
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<[u8]> for UncasedStr
[src]
impl<'_> AsRef<UncasedStr> for Uncased<'_>
[src]
pub fn as_ref(&self) -> &UncasedStr
[src]
impl AsRef<str> for 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.
pub fn index(&self, index: I) -> &<UncasedStr as Index<I>>::Output
[src]
impl Ord for UncasedStr
[src]
pub fn cmp(&self, other: &UncasedStr) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<'_> PartialEq<&'_ str> for UncasedStr
[src]
pub fn eq(&self, other: &&str) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<String> for UncasedStr
[src]
pub fn eq(&self, other: &String) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<UncasedStr> for UncasedStr
[src]
pub fn eq(&self, other: &UncasedStr) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialEq<str> for &'_ UncasedStr
[src]
pub fn eq(&self, other: &str) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<str> for UncasedStr
[src]
pub fn eq(&self, other: &str) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<String> for UncasedStr
[src]
pub fn partial_cmp(&self, other: &String) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<UncasedStr> for UncasedStr
[src]
pub fn partial_cmp(&self, other: &UncasedStr) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<str> for UncasedStr
[src]
Auto Trait Implementations
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsUncased for T where
T: AsRef<str> + ?Sized,
[src]
T: AsRef<str> + ?Sized,
pub fn as_uncased(&self) -> &UncasedStr
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,