pub struct HistorySize(/* private fields */);
Expand description
Size of blockchain history in segments.
Implementations§
source§impl HistorySize
impl HistorySize
sourcepub const fn new(value: NonZeroU64) -> Self
pub const fn new(value: NonZeroU64) -> Self
Create new instance.
sourcepub const fn in_pieces(&self) -> NonZeroU64
pub const fn in_pieces(&self) -> NonZeroU64
Size of blockchain history in pieces.
sourcepub fn segment_index(&self) -> SegmentIndex
pub fn segment_index(&self) -> SegmentIndex
Segment index that corresponds to this history size.
sourcepub fn sector_expiration_check(&self, min_sector_lifetime: Self) -> Option<Self>
pub fn sector_expiration_check(&self, min_sector_lifetime: Self) -> Option<Self>
History size at which expiration check for sector happens.
Returns None
on overflow.
Trait Implementations§
source§impl Clone for HistorySize
impl Clone for HistorySize
source§fn clone(&self) -> HistorySize
fn clone(&self) -> HistorySize
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 HistorySize
impl Debug for HistorySize
source§impl Decode for HistorySize
impl Decode for HistorySize
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 Deref for HistorySize
impl Deref for HistorySize
source§impl DerefMut for HistorySize
impl DerefMut for HistorySize
source§impl<'de> Deserialize<'de> for HistorySize
impl<'de> Deserialize<'de> for HistorySize
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 HistorySize
impl Display for HistorySize
source§impl Encode for HistorySize
impl Encode for HistorySize
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<HistorySize> for NonZeroU64
impl From<HistorySize> for NonZeroU64
source§fn from(value: HistorySize) -> Self
fn from(value: HistorySize) -> Self
Converts to this type from the input type.
source§impl From<NonZero<u64>> for HistorySize
impl From<NonZero<u64>> for HistorySize
source§fn from(value: NonZeroU64) -> Self
fn from(value: NonZeroU64) -> Self
Converts to this type from the input type.
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 Hash for HistorySize
impl Hash for HistorySize
source§impl MaxEncodedLen for HistorySize
impl MaxEncodedLen for HistorySize
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 Ord for HistorySize
impl Ord for HistorySize
source§fn cmp(&self, other: &HistorySize) -> Ordering
fn cmp(&self, other: &HistorySize) -> 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 HistorySize
impl PartialEq for HistorySize
source§impl PartialOrd for HistorySize
impl PartialOrd for HistorySize
source§impl Serialize for HistorySize
impl Serialize for HistorySize
source§impl TypeInfo for HistorySize
impl TypeInfo for HistorySize
impl Copy for HistorySize
impl EncodeLike for HistorySize
impl Eq for HistorySize
impl StructuralPartialEq for HistorySize
Auto Trait Implementations§
impl Freeze for HistorySize
impl RefUnwindSafe for HistorySize
impl Send for HistorySize
impl Sync for HistorySize
impl Unpin for HistorySize
impl UnwindSafe for HistorySize
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.