Struct opendal::raw::BytesContentRange
source · pub struct BytesContentRange(_, _, _);
Expand description
BytesContentRange is the content range of bytes.
<unit>
should always be bytes
.
Content-Range: bytes <range-start>-<range-end>/<size>
Content-Range: bytes <range-start>-<range-end>/*
Content-Range: bytes */<size>
Notes
Usage of the default.
BytesContentRange::default
is not a valid content range.
Please make sure their comes up with with_range
or with_size
call.
Allow clippy::len_without_is_empty
BytesContentRange implements len()
but not is_empty()
because it’s useless.
- When BytesContentRange’s range is known, it must be non-empty.
- When BytesContentRange’s range is no known, we don’t know whether it’s empty.
Implementations§
source§impl BytesContentRange
impl BytesContentRange
sourcepub fn with_range(self, start: u64, end: u64) -> Self
pub fn with_range(self, start: u64, end: u64) -> Self
Update BytesContentRange with range.
The range is inclusive: [start..=end]
as described in content-range
.
sourcepub fn len(&self) -> Option<u64>
pub fn len(&self) -> Option<u64>
Get the length that specified by this BytesContentRange, return None
if range is not known.
sourcepub fn size(&self) -> Option<u64>
pub fn size(&self) -> Option<u64>
Get the size of this BytesContentRange, return None
if size is not known.
sourcepub fn range(&self) -> Option<Range<u64>>
pub fn range(&self) -> Option<Range<u64>>
Get the range inclusive of this BytesContentRange, return None
if range is not known.
sourcepub fn range_inclusive(&self) -> Option<RangeInclusive<u64>>
pub fn range_inclusive(&self) -> Option<RangeInclusive<u64>>
Get the range inclusive of this BytesContentRange, return None
if range is not known.
sourcepub fn from_bytes_range(total_size: u64, range: BytesRange) -> Self
pub fn from_bytes_range(total_size: u64, range: BytesRange) -> Self
Calculate bytes content range from size and specified range.
sourcepub fn to_bytes_range(self) -> Option<BytesRange>
pub fn to_bytes_range(self) -> Option<BytesRange>
Calculate bytes range from bytes content range.
Trait Implementations§
source§impl Clone for BytesContentRange
impl Clone for BytesContentRange
source§fn clone(&self) -> BytesContentRange
fn clone(&self) -> BytesContentRange
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BytesContentRange
impl Debug for BytesContentRange
source§impl Default for BytesContentRange
impl Default for BytesContentRange
source§fn default() -> BytesContentRange
fn default() -> BytesContentRange
source§impl<'de> Deserialize<'de> for BytesContentRange
impl<'de> Deserialize<'de> for BytesContentRange
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl Display for BytesContentRange
impl Display for BytesContentRange
source§impl FromStr for BytesContentRange
impl FromStr for BytesContentRange
source§impl PartialEq<BytesContentRange> for BytesContentRange
impl PartialEq<BytesContentRange> for BytesContentRange
source§fn eq(&self, other: &BytesContentRange) -> bool
fn eq(&self, other: &BytesContentRange) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for BytesContentRange
impl Serialize for BytesContentRange
impl Copy for BytesContentRange
impl Eq for BytesContentRange
impl StructuralEq for BytesContentRange
impl StructuralPartialEq for BytesContentRange
Auto Trait Implementations§
impl RefUnwindSafe for BytesContentRange
impl Send for BytesContentRange
impl Sync for BytesContentRange
impl Unpin for BytesContentRange
impl UnwindSafe for BytesContentRange
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.