pub struct NonEmptyRange<Idx>(/* private fields */);Expand description
A non-empty Range (start..end) where start < end is guaranteed.
Implementations§
Source§impl<Idx: PartialOrd> NonEmptyRange<Idx>
impl<Idx: PartialOrd> NonEmptyRange<Idx>
Sourcepub fn new(range: Range<Idx>) -> Result<Self, EmptyRange>
pub fn new(range: Range<Idx>) -> Result<Self, EmptyRange>
Creates a NonEmptyRange if start < end.
Trait Implementations§
Source§impl<Idx: Clone> Clone for NonEmptyRange<Idx>
impl<Idx: Clone> Clone for NonEmptyRange<Idx>
Source§fn clone(&self) -> NonEmptyRange<Idx>
fn clone(&self) -> NonEmptyRange<Idx>
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<Idx: Debug> Debug for NonEmptyRange<Idx>
impl<Idx: Debug> Debug for NonEmptyRange<Idx>
Source§impl<Idx: EncodeSize> EncodeSize for NonEmptyRange<Idx>
impl<Idx: EncodeSize> EncodeSize for NonEmptyRange<Idx>
Source§fn encode_size(&self) -> usize
fn encode_size(&self) -> usize
Returns the encoded size of this value (in bytes).
Source§fn encode_inline_size(&self) -> usize
fn encode_inline_size(&self) -> usize
Returns the encoded size excluding bytes passed to
BufsMut::push
during Write::write_bufs. Used to size the working buffer for inline
writes. Override alongside Write::write_bufs for types where large
Bytes fields go via push; failing to do so will over-allocate.Source§impl<Idx> From<NonEmptyRange<Idx>> for Range<Idx>
impl<Idx> From<NonEmptyRange<Idx>> for Range<Idx>
Source§fn from(r: NonEmptyRange<Idx>) -> Self
fn from(r: NonEmptyRange<Idx>) -> Self
Converts to this type from the input type.
Source§impl<Idx: Hash> Hash for NonEmptyRange<Idx>
impl<Idx: Hash> Hash for NonEmptyRange<Idx>
Source§impl<Idx> IntoIterator for NonEmptyRange<Idx>
impl<Idx> IntoIterator for NonEmptyRange<Idx>
Source§impl<Idx: PartialEq> PartialEq for NonEmptyRange<Idx>
impl<Idx: PartialEq> PartialEq for NonEmptyRange<Idx>
Source§impl<Idx: Read + PartialOrd> Read for NonEmptyRange<Idx>
impl<Idx: Read + PartialOrd> Read for NonEmptyRange<Idx>
Source§impl<Idx: PartialOrd> TryFrom<Range<Idx>> for NonEmptyRange<Idx>
impl<Idx: PartialOrd> TryFrom<Range<Idx>> for NonEmptyRange<Idx>
Source§impl<Idx: Write + PartialOrd> Write for NonEmptyRange<Idx>
impl<Idx: Write + PartialOrd> Write for NonEmptyRange<Idx>
Source§fn write_bufs(&self, buf: &mut impl BufsMut)
fn write_bufs(&self, buf: &mut impl BufsMut)
Writes to a
BufsMut, allowing existing Bytes chunks to be
appended via BufsMut::push instead of written inline. Must encode
to the same format as Write::write. Defaults to Write::write.impl<Idx: Eq> Eq for NonEmptyRange<Idx>
impl<Idx> StructuralPartialEq for NonEmptyRange<Idx>
Auto Trait Implementations§
impl<Idx> Freeze for NonEmptyRange<Idx>where
Idx: Freeze,
impl<Idx> RefUnwindSafe for NonEmptyRange<Idx>where
Idx: RefUnwindSafe,
impl<Idx> Send for NonEmptyRange<Idx>where
Idx: Send,
impl<Idx> Sync for NonEmptyRange<Idx>where
Idx: Sync,
impl<Idx> Unpin for NonEmptyRange<Idx>where
Idx: Unpin,
impl<Idx> UnsafeUnpin for NonEmptyRange<Idx>where
Idx: UnsafeUnpin,
impl<Idx> UnwindSafe for NonEmptyRange<Idx>where
Idx: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<X, U> DecodeRangeExt<X> for U
impl<X, U> DecodeRangeExt<X> for U
Source§fn decode_range(
buf: impl Buf,
range: impl RangeBounds<usize>,
) -> Result<Self, Error>
fn decode_range( buf: impl Buf, range: impl RangeBounds<usize>, ) -> Result<Self, Error>
Decodes a value using only a range configuration. Read more
Source§impl<T> Encode for Twhere
T: Write + EncodeSize,
impl<T> Encode for Twhere
T: Write + EncodeSize,
Source§impl<X, U> ReadRangeExt<X> for U
impl<X, U> ReadRangeExt<X> for U
Source§fn read_range(
buf: &mut impl Buf,
range: impl RangeBounds<usize>,
) -> Result<Self, Error>
fn read_range( buf: &mut impl Buf, range: impl RangeBounds<usize>, ) -> Result<Self, Error>
Reads a value using only a range configuration. Read more