[−][src]Struct bstr::BStr
A wrapper for &[u8]
that provides convenient string oriented trait impls.
If you need ownership or a growable byte string buffer, then use
BString
.
Using a &BStr
is just like using a &[u8]
, since BStr
implements Deref
to [u8]
. So all methods available on [u8]
are also available on BStr
.
Representation
A &BStr
has the same representation as a &str
. That is, a &BStr
is
a fat pointer which consists of a pointer to some bytes and a length.
Trait implementations
The BStr
type has a number of trait implementations, and in particular,
defines equality and ordinal comparisons between &BStr
, &str
and
&[u8]
for convenience.
The Debug
implementation for BStr
shows its bytes as a normal string.
For invalid UTF-8, hex escape sequences are used.
The Display
implementation behaves as if BStr
were first lossily
converted to a str
. Invalid UTF-8 bytes are substituted with the Unicode
replacement codepoint, which looks like this: �.
Trait Implementations
impl AsMut<[u8]> for BStr
[src]
impl AsMut<BStr> for BString
[src]
impl AsMut<BStr> for [u8]
[src]
impl AsRef<[u8]> for BStr
[src]
impl AsRef<BStr> for BString
[src]
impl AsRef<BStr> for [u8]
[src]
impl AsRef<BStr> for str
[src]
impl Borrow<BStr> for BString
[src]
impl Debug for BStr
[src]
impl<'a> Default for &'a BStr
[src]
impl<'a> Default for &'a mut BStr
[src]
impl Deref for BStr
[src]
impl DerefMut for BStr
[src]
impl<'a, 'de: 'a> Deserialize<'de> for &'a BStr
[src]
fn deserialize<D>(deserializer: D) -> Result<&'a BStr, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Display for BStr
[src]
impl Eq for BStr
[src]
impl<'a> From<&'a [u8]> for &'a BStr
[src]
impl<'a> From<&'a BStr> for BString
[src]
impl<'a> From<&'a BStr> for Cow<'a, BStr>
[src]
impl<'a> From<&'a str> for &'a BStr
[src]
impl<'a> FromIterator<&'a BStr> for BString
[src]
fn from_iter<T: IntoIterator<Item = &'a BStr>>(iter: T) -> BString
[src]
impl Hash for BStr
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Index<Range<usize>> for BStr
[src]
impl Index<RangeFrom<usize>> for BStr
[src]
type Output = BStr
The returned type after indexing.
fn index(&self, r: RangeFrom<usize>) -> &BStr
[src]
impl Index<RangeFull> for BStr
[src]
impl Index<RangeInclusive<usize>> for BStr
[src]
type Output = BStr
The returned type after indexing.
fn index(&self, r: RangeInclusive<usize>) -> &BStr
[src]
impl Index<RangeTo<usize>> for BStr
[src]
type Output = BStr
The returned type after indexing.
fn index(&self, r: RangeTo<usize>) -> &BStr
[src]
impl Index<RangeToInclusive<usize>> for BStr
[src]
type Output = BStr
The returned type after indexing.
fn index(&self, r: RangeToInclusive<usize>) -> &BStr
[src]
impl Index<usize> for BStr
[src]
impl IndexMut<Range<usize>> for BStr
[src]
impl IndexMut<RangeFrom<usize>> for BStr
[src]
impl IndexMut<RangeFull> for BStr
[src]
impl IndexMut<RangeInclusive<usize>> for BStr
[src]
fn index_mut(&mut self, r: RangeInclusive<usize>) -> &mut BStr
[src]
impl IndexMut<RangeTo<usize>> for BStr
[src]
impl IndexMut<RangeToInclusive<usize>> for BStr
[src]
fn index_mut(&mut self, r: RangeToInclusive<usize>) -> &mut BStr
[src]
impl IndexMut<usize> for BStr
[src]
impl Ord for BStr
[src]
fn cmp(&self, other: &BStr) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<'a, 'b> PartialEq<&'a [u8]> for BStr
[src]
impl<'a, 'b> PartialEq<&'a BStr> for BString
[src]
impl<'a, 'b> PartialEq<&'a BStr> for Vec<u8>
[src]
impl<'a, 'b> PartialEq<&'a BStr> for String
[src]
impl<'a, 'b> PartialEq<&'a BStr> for Cow<'a, BStr>
[src]
impl<'a, 'b> PartialEq<&'a BStr> for Cow<'a, str>
[src]
impl<'a, 'b> PartialEq<&'a BStr> for Cow<'a, [u8]>
[src]
impl<'a, 'b> PartialEq<&'a str> for BStr
[src]
impl<'a, 'b> PartialEq<[u8]> for BStr
[src]
impl<'a, 'b> PartialEq<BStr> for BString
[src]
impl PartialEq<BStr> for BStr
[src]
impl<'a, 'b> PartialEq<BStr> for [u8]
[src]
impl<'a, 'b> PartialEq<BStr> for &'a [u8]
[src]
impl<'a, 'b> PartialEq<BStr> for str
[src]
impl<'a, 'b> PartialEq<BStr> for &'a str
[src]
impl<'a, 'b> PartialEq<BStr> for Vec<u8>
[src]
impl<'a, 'b> PartialEq<BStr> for String
[src]
impl<'a, 'b> PartialEq<BString> for BStr
[src]
impl<'a, 'b> PartialEq<BString> for &'a BStr
[src]
impl<'a, 'b> PartialEq<Cow<'a, [u8]>> for &'a BStr
[src]
fn eq(&self, other: &Cow<'a, [u8]>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialEq<Cow<'a, BStr>> for &'a BStr
[src]
fn eq(&self, other: &Cow<'a, BStr>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialEq<Cow<'a, str>> for &'a BStr
[src]
fn eq(&self, other: &Cow<'a, str>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialEq<String> for BStr
[src]
impl<'a, 'b> PartialEq<String> for &'a BStr
[src]
impl<'a, 'b> PartialEq<Vec<u8>> for BStr
[src]
impl<'a, 'b> PartialEq<Vec<u8>> for &'a BStr
[src]
impl<'a, 'b> PartialEq<str> for BStr
[src]
impl<'a, 'b> PartialOrd<&'a [u8]> for BStr
[src]
fn partial_cmp(&self, other: &&'a [u8]) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<&'a BStr> for BString
[src]
fn partial_cmp(&self, other: &&'a BStr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<&'a BStr> for Vec<u8>
[src]
fn partial_cmp(&self, other: &&'a BStr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<&'a BStr> for String
[src]
fn partial_cmp(&self, other: &&'a BStr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<&'a str> for BStr
[src]
fn partial_cmp(&self, other: &&'a str) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<[u8]> for BStr
[src]
fn partial_cmp(&self, other: &[u8]) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<BStr> for BString
[src]
fn partial_cmp(&self, other: &BStr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<BStr> for BStr
[src]
fn partial_cmp(&self, other: &BStr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<BStr> for [u8]
[src]
fn partial_cmp(&self, other: &BStr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<BStr> for &'a [u8]
[src]
fn partial_cmp(&self, other: &BStr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<BStr> for str
[src]
fn partial_cmp(&self, other: &BStr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<BStr> for &'a str
[src]
fn partial_cmp(&self, other: &BStr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<BStr> for Vec<u8>
[src]
fn partial_cmp(&self, other: &BStr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<BStr> for String
[src]
fn partial_cmp(&self, other: &BStr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<BString> for BStr
[src]
fn partial_cmp(&self, other: &BString) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<BString> for &'a BStr
[src]
fn partial_cmp(&self, other: &BString) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<String> for BStr
[src]
fn partial_cmp(&self, other: &String) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<String> for &'a BStr
[src]
fn partial_cmp(&self, other: &String) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<Vec<u8>> for BStr
[src]
fn partial_cmp(&self, other: &Vec<u8>) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<Vec<u8>> for &'a BStr
[src]
fn partial_cmp(&self, other: &Vec<u8>) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, 'b> PartialOrd<str> for BStr
[src]
fn partial_cmp(&self, other: &str) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for BStr
[src]
impl ToOwned for BStr
[src]
Auto Trait Implementations
impl RefUnwindSafe for BStr
impl Send for BStr
impl Sync for BStr
impl Unpin for BStr
impl UnwindSafe for BStr
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,