Struct zerotrie::builder::bytestr::ByteStr

source ·
#[repr(transparent)]
pub(crate) struct ByteStr([u8]);
Expand description

A struct transparent over [u8] with convenient helper functions.

Tuple Fields§

§0: [u8]

Implementations§

source§

impl ByteStr

source

pub const fn from_byte_slice_with_value<'a, 'l>( input: &'l [(&'a [u8], usize)], ) -> &'l [(&'a ByteStr, usize)]

source

pub const fn from_str_slice_with_value<'a, 'l>( input: &'l [(&'a str, usize)], ) -> &'l [(&'a ByteStr, usize)]

source

pub fn from_bytes(input: &[u8]) -> &Self

source

pub fn from_str(input: &str) -> &Self

source

pub fn empty() -> &'static Self

source

pub const fn as_bytes(&self) -> &[u8]

source

pub const fn len(&self) -> usize

source

pub fn is_all_ascii(&self) -> bool

source

pub(crate) fn byte_at(&self, index: usize) -> Option<u8>

source

pub(crate) const fn byte_at_or_panic(&self, index: usize) -> u8

Returns the byte at the given index, panicking if out of bounds.

source

pub(crate) const fn is_less_then(&self, other: &Self) -> bool

Const function to evaluate self < other.

source

pub(crate) const fn prefix_eq(&self, other: &ByteStr, prefix_len: usize) -> bool

Const function to evaluate self[..prefix_len] == other[..prefix_len]

Trait Implementations§

source§

impl Borrow<[u8]> for Box<ByteStr>

source§

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

Immutably borrows from an owned value. Read more
source§

impl Borrow<[u8]> for ByteStr

source§

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

Immutably borrows from an owned value. Read more
source§

impl Ord for ByteStr

source§

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

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

impl PartialEq for ByteStr

source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for ByteStr

source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · 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 · 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 · 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 · 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 Eq for ByteStr

source§

impl StructuralPartialEq for ByteStr

Auto Trait Implementations§

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