Enum zarrs::byte_range::ByteRange
source · pub enum ByteRange {
FromStart(ByteOffset, Option<ByteLength>),
FromEnd(ByteOffset, Option<ByteLength>),
}
Expand description
A byte range.
Variants§
FromStart(ByteOffset, Option<ByteLength>)
A byte range from the start.
If the byte length is None
, reads to the end of the value.
FromEnd(ByteOffset, Option<ByteLength>)
A byte range from the end.
If the byte length is None
, reads to the start of the value.
Implementations§
source§impl ByteRange
impl ByteRange
sourcepub fn start(&self, size: u64) -> u64
pub fn start(&self, size: u64) -> u64
Return the start of a byte range. size
is the size of the entire bytes.
sourcepub fn end(&self, size: u64) -> u64
pub fn end(&self, size: u64) -> u64
Return the exclusive end of a byte range. size
is the size of the entire bytes.
sourcepub const fn offset(&self) -> u64
pub const fn offset(&self) -> u64
Return the internal offset of the byte range (which can be at its start or end).
sourcepub fn length(&self, size: u64) -> u64
pub fn length(&self, size: u64) -> u64
Return the length of a byte range. size
is the size of the entire bytes.
sourcepub fn to_range_usize(&self, size: u64) -> Range<usize>
pub fn to_range_usize(&self, size: u64) -> Range<usize>
Trait Implementations§
source§impl PartialEq for ByteRange
impl PartialEq for ByteRange
impl Copy for ByteRange
impl Eq for ByteRange
impl StructuralPartialEq for ByteRange
Auto Trait Implementations§
impl Freeze for ByteRange
impl RefUnwindSafe for ByteRange
impl Send for ByteRange
impl Sync for ByteRange
impl Unpin for ByteRange
impl UnwindSafe for ByteRange
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.