Struct net_traits::filemanager_thread::RelativePos
source · pub struct RelativePos {
pub start: i64,
pub end: Option<i64>,
}
Expand description
Relative slice positions of a sequence, whose semantic should be consistent with (start, end) parameters in https://w3c.github.io/FileAPI/#dfn-slice
Fields§
§start: i64
Relative to first byte if non-negative, relative to one past last byte if negative,
end: Option<i64>
Relative offset from first byte if Some(non-negative), relative to one past last byte if Some(negative), None if one past last byte
Implementations§
source§impl RelativePos
impl RelativePos
sourcepub fn full_range() -> RelativePos
pub fn full_range() -> RelativePos
Full range from start to end
sourcepub fn from_opts(start: Option<i64>, end: Option<i64>) -> RelativePos
pub fn from_opts(start: Option<i64>, end: Option<i64>) -> RelativePos
Instantiate optional slice position parameters
sourcepub fn slice_inner(&self, rel_pos: &RelativePos) -> RelativePos
pub fn slice_inner(&self, rel_pos: &RelativePos) -> RelativePos
Slice the inner sliced range by repositioning
sourcepub fn to_abs_range(&self, size: usize) -> Range<usize>
pub fn to_abs_range(&self, size: usize) -> Range<usize>
Compute absolute range by giving the total size https://w3c.github.io/FileAPI/#slice-method-algo
Trait Implementations§
source§impl Clone for RelativePos
impl Clone for RelativePos
source§fn clone(&self) -> RelativePos
fn clone(&self) -> RelativePos
Returns a copy 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 Debug for RelativePos
impl Debug for RelativePos
source§impl<'de> Deserialize<'de> for RelativePos
impl<'de> Deserialize<'de> for RelativePos
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl MallocSizeOf for RelativePos
impl MallocSizeOf for RelativePos
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
Auto Trait Implementations§
impl Freeze for RelativePos
impl RefUnwindSafe for RelativePos
impl Send for RelativePos
impl Sync for RelativePos
impl Unpin for RelativePos
impl UnwindSafe for RelativePos
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert