pub struct SegmentIndex(/* private fields */);
Expand description
Segment index type.
Implementations§
source§impl SegmentIndex
impl SegmentIndex
sourcepub const ZERO: SegmentIndex = _
pub const ZERO: SegmentIndex = _
Segment index 0.
sourcepub const ONE: SegmentIndex = _
pub const ONE: SegmentIndex = _
Segment index 1.
sourcepub fn first_piece_index(&self) -> PieceIndex
pub fn first_piece_index(&self) -> PieceIndex
Get the first piece index in this segment.
sourcepub fn last_piece_index(&self) -> PieceIndex
pub fn last_piece_index(&self) -> PieceIndex
Get the last piece index in this segment.
sourcepub fn segment_piece_indexes(&self) -> [PieceIndex; 256]
pub fn segment_piece_indexes(&self) -> [PieceIndex; 256]
List of piece indexes that belong to this segment.
sourcepub fn segment_piece_indexes_source_first(&self) -> [PieceIndex; 256]
pub fn segment_piece_indexes_source_first(&self) -> [PieceIndex; 256]
List of piece indexes that belong to this segment with source pieces first.
sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Checked integer subtraction. Computes self - rhs
, returning None
if overflow occurred.
Trait Implementations§
source§impl Add for SegmentIndex
impl Add for SegmentIndex
source§type Output = SegmentIndex
type Output = SegmentIndex
The resulting type after applying the
+
operator.source§fn add(self, rhs: SegmentIndex) -> SegmentIndex
fn add(self, rhs: SegmentIndex) -> SegmentIndex
Performs the
+
operation. Read moresource§impl AddAssign for SegmentIndex
impl AddAssign for SegmentIndex
source§fn add_assign(&mut self, rhs: SegmentIndex)
fn add_assign(&mut self, rhs: SegmentIndex)
Performs the
+=
operation. Read moresource§impl Clone for SegmentIndex
impl Clone for SegmentIndex
source§fn clone(&self) -> SegmentIndex
fn clone(&self) -> SegmentIndex
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 SegmentIndex
impl Debug for SegmentIndex
source§impl Decode for SegmentIndex
impl Decode for SegmentIndex
source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Attempt to deserialise the value from input.
source§fn decode_into<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
dst_: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>
fn decode_into<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, dst_: &mut MaybeUninit<Self>, ) -> Result<DecodeFinished, Error>
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
Attempt to skip the encoded value from input. Read more
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
source§impl Default for SegmentIndex
impl Default for SegmentIndex
source§fn default() -> SegmentIndex
fn default() -> SegmentIndex
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for SegmentIndex
impl<'de> Deserialize<'de> for SegmentIndex
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 Display for SegmentIndex
impl Display for SegmentIndex
source§impl<__RhsT> Div<__RhsT> for SegmentIndex
impl<__RhsT> Div<__RhsT> for SegmentIndex
source§type Output = SegmentIndex
type Output = SegmentIndex
The resulting type after applying the
/
operator.source§fn div(self, rhs: __RhsT) -> SegmentIndex
fn div(self, rhs: __RhsT) -> SegmentIndex
Performs the
/
operation. Read moresource§impl<__RhsT> DivAssign<__RhsT> for SegmentIndex
impl<__RhsT> DivAssign<__RhsT> for SegmentIndex
source§fn div_assign(&mut self, rhs: __RhsT)
fn div_assign(&mut self, rhs: __RhsT)
Performs the
/=
operation. Read moresource§impl Encode for SegmentIndex
impl Encode for SegmentIndex
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
source§fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>(
&self,
f: __CodecUsingEncodedCallback,
) -> __CodecOutputReturn
fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>( &self, f: __CodecUsingEncodedCallback, ) -> __CodecOutputReturn
Convert self to a slice and then invoke the given closure with it.
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
source§impl From<SegmentIndex> for HistorySize
impl From<SegmentIndex> for HistorySize
source§fn from(value: SegmentIndex) -> Self
fn from(value: SegmentIndex) -> Self
Converts to this type from the input type.
source§impl From<SegmentIndex> for u64
impl From<SegmentIndex> for u64
source§fn from(value: SegmentIndex) -> Self
fn from(value: SegmentIndex) -> Self
Converts to this type from the input type.
source§impl From<u64> for SegmentIndex
impl From<u64> for SegmentIndex
source§impl Hash for SegmentIndex
impl Hash for SegmentIndex
source§impl MaxEncodedLen for SegmentIndex
impl MaxEncodedLen for SegmentIndex
source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Upper bound, in bytes, of the maximum encoded size of this item.
source§impl<__RhsT> Mul<__RhsT> for SegmentIndex
impl<__RhsT> Mul<__RhsT> for SegmentIndex
source§type Output = SegmentIndex
type Output = SegmentIndex
The resulting type after applying the
*
operator.source§fn mul(self, rhs: __RhsT) -> SegmentIndex
fn mul(self, rhs: __RhsT) -> SegmentIndex
Performs the
*
operation. Read moresource§impl<__RhsT> MulAssign<__RhsT> for SegmentIndex
impl<__RhsT> MulAssign<__RhsT> for SegmentIndex
source§fn mul_assign(&mut self, rhs: __RhsT)
fn mul_assign(&mut self, rhs: __RhsT)
Performs the
*=
operation. Read moresource§impl Ord for SegmentIndex
impl Ord for SegmentIndex
source§fn cmp(&self, other: &SegmentIndex) -> Ordering
fn cmp(&self, other: &SegmentIndex) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for SegmentIndex
impl PartialEq for SegmentIndex
source§impl PartialOrd for SegmentIndex
impl PartialOrd for SegmentIndex
source§impl Serialize for SegmentIndex
impl Serialize for SegmentIndex
source§impl Step for SegmentIndex
impl Step for SegmentIndex
source§fn steps_between(start: &Self, end: &Self) -> Option<usize>
fn steps_between(start: &Self, end: &Self) -> Option<usize>
🔬This is a nightly-only experimental API. (
step_trait
)source§fn forward_checked(start: Self, count: usize) -> Option<Self>
fn forward_checked(start: Self, count: usize) -> Option<Self>
🔬This is a nightly-only experimental API. (
step_trait
)source§fn backward_checked(start: Self, count: usize) -> Option<Self>
fn backward_checked(start: Self, count: usize) -> Option<Self>
🔬This is a nightly-only experimental API. (
step_trait
)source§fn forward(start: Self, count: usize) -> Self
fn forward(start: Self, count: usize) -> Self
🔬This is a nightly-only experimental API. (
step_trait
)source§unsafe fn forward_unchecked(start: Self, count: usize) -> Self
unsafe fn forward_unchecked(start: Self, count: usize) -> Self
🔬This is a nightly-only experimental API. (
step_trait
)source§fn backward(start: Self, count: usize) -> Self
fn backward(start: Self, count: usize) -> Self
🔬This is a nightly-only experimental API. (
step_trait
)source§unsafe fn backward_unchecked(start: Self, count: usize) -> Self
unsafe fn backward_unchecked(start: Self, count: usize) -> Self
🔬This is a nightly-only experimental API. (
step_trait
)source§impl Sub for SegmentIndex
impl Sub for SegmentIndex
source§type Output = SegmentIndex
type Output = SegmentIndex
The resulting type after applying the
-
operator.source§fn sub(self, rhs: SegmentIndex) -> SegmentIndex
fn sub(self, rhs: SegmentIndex) -> SegmentIndex
Performs the
-
operation. Read moresource§impl SubAssign for SegmentIndex
impl SubAssign for SegmentIndex
source§fn sub_assign(&mut self, rhs: SegmentIndex)
fn sub_assign(&mut self, rhs: SegmentIndex)
Performs the
-=
operation. Read moresource§impl TypeInfo for SegmentIndex
impl TypeInfo for SegmentIndex
impl Copy for SegmentIndex
impl EncodeLike for SegmentIndex
impl Eq for SegmentIndex
impl StructuralPartialEq for SegmentIndex
Auto Trait Implementations§
impl Freeze for SegmentIndex
impl RefUnwindSafe for SegmentIndex
impl Send for SegmentIndex
impl Sync for SegmentIndex
impl Unpin for SegmentIndex
impl UnwindSafe for SegmentIndex
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> DecodeAll for Twhere
T: Decode,
impl<T> DecodeAll for Twhere
T: Decode,
§fn decode_all(input: &mut &[u8]) -> Result<T, Error>
fn decode_all(input: &mut &[u8]) -> Result<T, Error>
Decode
Self
and consume all of the given input data. Read more§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
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 more§impl<T> KeyedVec for Twhere
T: Codec,
impl<T> KeyedVec for Twhere
T: Codec,
§fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>
fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>
Return an encoding of
Self
prepended by given slice.