zerotrie::builder::bytestr

Struct 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