Struct regex_automata::util::alphabet::ByteSet
source · pub(crate) struct ByteSet {
bits: BitSet,
}
Expand description
A simple set of bytes that is reasonably cheap to copy and allocation free.
Fields§
§bits: BitSet
Implementations§
source§impl ByteSet
impl ByteSet
sourcepub(crate) fn add(&mut self, byte: u8)
pub(crate) fn add(&mut self, byte: u8)
Add a byte to this set.
If the given byte already belongs to this set, then this is a no-op.
sourcepub(crate) fn remove(&mut self, byte: u8)
pub(crate) fn remove(&mut self, byte: u8)
Remove a byte from this set.
If the given byte is not in this set, then this is a no-op.
sourcepub(crate) fn contains(&self, byte: u8) -> bool
pub(crate) fn contains(&self, byte: u8) -> bool
Return true if and only if the given byte is in this set.
sourcepub(crate) fn contains_range(&self, start: u8, end: u8) -> bool
pub(crate) fn contains_range(&self, start: u8, end: u8) -> bool
Return true if and only if the given inclusive range of bytes is in this set.
sourcepub(crate) fn iter(&self) -> ByteSetIter<'_> ⓘ
pub(crate) fn iter(&self) -> ByteSetIter<'_> ⓘ
Returns an iterator over all bytes in this set.
sourcepub(crate) fn iter_ranges(&self) -> ByteSetRangeIter<'_> ⓘ
pub(crate) fn iter_ranges(&self) -> ByteSetRangeIter<'_> ⓘ
Returns an iterator over all contiguous ranges of bytes in this set.
sourcepub(crate) fn from_bytes(
slice: &[u8],
) -> Result<(ByteSet, usize), DeserializeError>
pub(crate) fn from_bytes( slice: &[u8], ) -> Result<(ByteSet, usize), DeserializeError>
Deserializes a byte set from the given slice. If the slice is of incorrect length or is otherwise malformed, then an error is returned. Upon success, the number of bytes read along with the set are returned. The number of bytes read is always a multiple of 8.
sourcepub(crate) fn write_to<E: Endian>(
&self,
dst: &mut [u8],
) -> Result<usize, SerializeError>
pub(crate) fn write_to<E: Endian>( &self, dst: &mut [u8], ) -> Result<usize, SerializeError>
Writes this byte set to the given byte buffer. If the given buffer is too small, then an error is returned. Upon success, the total number of bytes written is returned. The number of bytes written is guaranteed to be a multiple of 8.
sourcepub(crate) fn write_to_len(&self) -> usize
pub(crate) fn write_to_len(&self) -> usize
Returns the total number of bytes written by write_to
.
Trait Implementations§
impl Copy for ByteSet
impl Eq for ByteSet
impl StructuralPartialEq for ByteSet
Auto Trait Implementations§
impl Freeze for ByteSet
impl RefUnwindSafe for ByteSet
impl Send for ByteSet
impl Sync for ByteSet
impl Unpin for ByteSet
impl UnwindSafe for ByteSet
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)