Skip to main content

BStr

Struct BStr 

Source
pub struct BStr(/* private fields */);
Expand description

A wrapper type for str which implements Borrow<[u8]> and hashes in the same way as a byte slice.

Implementations§

Source§

impl BStr

Source

pub fn as_str(&self) -> &str

Trait Implementations§

Source§

impl AsRef<BStr> for str

Source§

fn as_ref(&self) -> &BStr

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

impl Borrow<BStr> for BString

Source§

fn borrow(&self) -> &BStr

Immutably borrows from an owned value. Read more
Source§

impl Borrow<[u8]> for BStr

Source§

fn borrow(&self) -> &[u8] ⓘ

Immutably borrows from an owned value. Read more
Source§

impl Break for BStr

Source§

type Split = BStr

Source§

fn empty<'a>() -> &'a BStr

Source§

fn find_break(&self, loc: usize) -> &BStr

Source§

impl Debug for BStr

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for BStr

Source§

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

Source§

fn from(s: &'a str) -> &'a BStr

Converts to this type from the input type.
Source§

impl Hash for BStr

Source§

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

Feeds this value into the given Hasher. Read more
Source§

impl Ord for BStr

Source§

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

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

impl PartialEq for BStr

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for BStr

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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
Source§

impl StructuralPartialEq for BStr

Source§

impl ToOwned for BStr

Source§

type Owned = BString

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> BString

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more

Auto Trait Implementations§

§

impl !Sized for BStr

§

impl Freeze for BStr

§

impl RefUnwindSafe for BStr

§

impl Send for BStr

§

impl Sync for BStr

§

impl Unpin for BStr

§

impl UnsafeUnpin for BStr

§

impl UnwindSafe for BStr

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