#[repr(C)]pub struct SolutionDistance(/* private fields */);
Expand description
Solution distance
Implementations§
Source§impl SolutionDistance
impl SolutionDistance
Sourcepub fn calculate(
global_challenge: &Blake3Hash,
chunk: &[u8; 32],
sector_slot_challenge: &SectorSlotChallenge,
) -> Self
pub fn calculate( global_challenge: &Blake3Hash, chunk: &[u8; 32], sector_slot_challenge: &SectorSlotChallenge, ) -> Self
Calculate solution distance for given parameters.
Typically used as a primitive to check whether solution distance is within solution range
(see Self::is_within()
).
Sourcepub const fn is_within(self, solution_range: SolutionRange) -> bool
pub const fn is_within(self, solution_range: SolutionRange) -> bool
Check if solution distance is within the provided solution range
Trait Implementations§
Source§impl Clone for SolutionDistance
impl Clone for SolutionDistance
Source§fn clone(&self) -> SolutionDistance
fn clone(&self) -> SolutionDistance
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 SolutionDistance
impl Debug for SolutionDistance
Source§impl Decode for SolutionDistance
impl Decode for SolutionDistance
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.
§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
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 SolutionDistance
impl Default for SolutionDistance
Source§fn default() -> SolutionDistance
fn default() -> SolutionDistance
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SolutionDistance
impl<'de> Deserialize<'de> for SolutionDistance
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 SolutionDistance
impl Display for SolutionDistance
Source§impl Encode for SolutionDistance
impl Encode for SolutionDistance
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<SolutionDistance> for u64
impl From<SolutionDistance> for u64
Source§fn from(value: SolutionDistance) -> Self
fn from(value: SolutionDistance) -> Self
Converts to this type from the input type.
Source§impl From<u64> for SolutionDistance
impl From<u64> for SolutionDistance
Source§impl Hash for SolutionDistance
impl Hash for SolutionDistance
Source§impl MaxEncodedLen for SolutionDistance
impl MaxEncodedLen for SolutionDistance
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 SolutionDistance
impl Ord for SolutionDistance
Source§fn cmp(&self, other: &SolutionDistance) -> Ordering
fn cmp(&self, other: &SolutionDistance) -> 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 SolutionDistance
impl PartialEq for SolutionDistance
Source§impl PartialOrd for SolutionDistance
impl PartialOrd for SolutionDistance
Source§impl Serialize for SolutionDistance
impl Serialize for SolutionDistance
Source§impl TypeInfo for SolutionDistance
impl TypeInfo for SolutionDistance
impl Copy for SolutionDistance
impl EncodeLike for SolutionDistance
impl Eq for SolutionDistance
impl StructuralPartialEq for SolutionDistance
Auto Trait Implementations§
impl Freeze for SolutionDistance
impl RefUnwindSafe for SolutionDistance
impl Send for SolutionDistance
impl Sync for SolutionDistance
impl Unpin for SolutionDistance
impl UnwindSafe for SolutionDistance
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,
§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