pub struct BytesRange<'a> { /* private fields */ }
Expand description
Subrange of a StrQueue
.
This can be created by StrQueue::bytes_range
.
The range can contain any bytes.
Implementations§
Source§impl<'a> BytesRange<'a>
Subrange access.
impl<'a> BytesRange<'a>
Subrange access.
Sourcepub fn range<R>(&self, range: R) -> Selfwhere
R: RangeBounds<usize>,
pub fn range<R>(&self, range: R) -> Selfwhere
R: RangeBounds<usize>,
Source§impl<'a> BytesRange<'a>
Content length and existence.
impl<'a> BytesRange<'a>
Content length and existence.
Source§impl<'a> BytesRange<'a>
Range and content manipulation.
impl<'a> BytesRange<'a>
Range and content manipulation.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the range, removing all elements.
§Examples
use str_queue::{PartialHandling, StrQueue};
let queue = StrQueue::from(b"Hello \xce");
let mut range = queue.bytes_range(..);
assert!(!range.is_empty());
range.clear();
assert!(range.is_empty());
// Only the range is cleared. The underlying queue does not change.
assert!(!queue.is_empty());
Sourcepub fn pop(&mut self) -> Option<u8>
pub fn pop(&mut self) -> Option<u8>
Pops the first byte in the range and returns it.
§Examples
use str_queue::StrQueue;
let queue = StrQueue::from("abc\u{03B1}");
let mut range = queue.bytes_range(..);
assert_eq!(range.pop(), Some(b'a'));
assert_eq!(range.pop(), Some(b'b'));
assert_eq!(range.pop(), Some(b'c'));
assert_eq!(range.pop(), Some(b'\xce'));
assert_eq!(range.pop(), Some(b'\xb1'));
assert_eq!(range.pop(), None);
assert!(range.is_empty());
Trait Implementations§
Source§impl<'a> Clone for BytesRange<'a>
impl<'a> Clone for BytesRange<'a>
Source§fn clone(&self) -> BytesRange<'a>
fn clone(&self) -> BytesRange<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a> Debug for BytesRange<'a>
impl<'a> Debug for BytesRange<'a>
Source§impl<'a> From<CharsRange<'a>> for BytesRange<'a>
impl<'a> From<CharsRange<'a>> for BytesRange<'a>
Source§fn from(v: CharsRange<'a>) -> Self
fn from(v: CharsRange<'a>) -> Self
Converts to this type from the input type.
Source§impl Hash for BytesRange<'_>
impl Hash for BytesRange<'_>
Source§impl Ord for BytesRange<'_>
impl Ord for BytesRange<'_>
Source§impl PartialEq<&[u8]> for BytesRange<'_>
impl PartialEq<&[u8]> for BytesRange<'_>
Source§impl PartialEq<[u8]> for BytesRange<'_>
impl PartialEq<[u8]> for BytesRange<'_>
Source§impl PartialEq<BytesRange<'_>> for &[u8]
impl PartialEq<BytesRange<'_>> for &[u8]
Source§impl PartialEq<BytesRange<'_>> for [u8]
impl PartialEq<BytesRange<'_>> for [u8]
Source§impl PartialEq for BytesRange<'_>
impl PartialEq for BytesRange<'_>
Source§impl PartialOrd<&[u8]> for BytesRange<'_>
impl PartialOrd<&[u8]> for BytesRange<'_>
Source§impl PartialOrd<[u8]> for BytesRange<'_>
impl PartialOrd<[u8]> for BytesRange<'_>
Source§impl PartialOrd<BytesRange<'_>> for &[u8]
impl PartialOrd<BytesRange<'_>> for &[u8]
Source§impl PartialOrd<BytesRange<'_>> for [u8]
impl PartialOrd<BytesRange<'_>> for [u8]
Source§impl PartialOrd for BytesRange<'_>
impl PartialOrd for BytesRange<'_>
impl<'a> Copy for BytesRange<'a>
impl<'a> Eq for BytesRange<'a>
Auto Trait Implementations§
impl<'a> Freeze for BytesRange<'a>
impl<'a> RefUnwindSafe for BytesRange<'a>
impl<'a> Send for BytesRange<'a>
impl<'a> Sync for BytesRange<'a>
impl<'a> Unpin for BytesRange<'a>
impl<'a> UnwindSafe for BytesRange<'a>
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
Mutably borrows from an owned value. Read more