pub struct PuzzleSolutions<N: Network> { /* private fields */ }
Expand description
The individual solutions.
Implementations§
Source§impl<N: Network> PuzzleSolutions<N>
impl<N: Network> PuzzleSolutions<N>
Sourcepub fn new(solutions: Vec<Solution<N>>) -> Result<Self>
pub fn new(solutions: Vec<Solution<N>>) -> Result<Self>
Initializes a new instance of the solutions.
Sourcepub fn solution_ids(&self) -> impl '_ + Iterator<Item = &SolutionID<N>>
pub fn solution_ids(&self) -> impl '_ + Iterator<Item = &SolutionID<N>>
Returns the solution IDs.
Sourcepub fn get_solution(&self, solution_id: &SolutionID<N>) -> Option<&Solution<N>>
pub fn get_solution(&self, solution_id: &SolutionID<N>) -> Option<&Solution<N>>
Returns the solution for the given solution ID.
Sourcepub fn to_accumulator_point(&self) -> Result<Field<N>>
pub fn to_accumulator_point(&self) -> Result<Field<N>>
Returns the accumulator challenge point.
Methods from Deref<Target = IndexMap<SolutionID<N>, Solution<N>>>§
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Return the number of elements the map can hold without reallocating.
This number is a lower bound; the map might be able to hold more, but is guaranteed to be able to hold at least this many.
Computes in O(1) time.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Return the number of key-value pairs in the map.
Computes in O(1) time.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the map contains no elements.
Computes in O(1) time.
Sourcepub fn iter(&self) -> Iter<'_, K, V>
pub fn iter(&self) -> Iter<'_, K, V>
Return an iterator over the key-value pairs of the map, in their order
Sourcepub fn keys(&self) -> Keys<'_, K, V>
pub fn keys(&self) -> Keys<'_, K, V>
Return an iterator over the keys of the map, in their order
Sourcepub fn values(&self) -> Values<'_, K, V>
pub fn values(&self) -> Values<'_, K, V>
Return an iterator over the values of the map, in their order
Sourcepub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
Return true
if an equivalent to key
exists in the map.
Computes in O(1) time (average).
Sourcepub fn get<Q>(&self, key: &Q) -> Option<&V>
pub fn get<Q>(&self, key: &Q) -> Option<&V>
Return a reference to the value stored for key
, if it is present,
else None
.
Computes in O(1) time (average).
Sourcepub fn get_key_value<Q>(&self, key: &Q) -> Option<(&K, &V)>
pub fn get_key_value<Q>(&self, key: &Q) -> Option<(&K, &V)>
Return references to the key-value pair stored for key
,
if it is present, else None
.
Computes in O(1) time (average).
Sourcepub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>
pub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>
Return item index, if it exists in the map
Computes in O(1) time (average).
Sourcepub fn binary_search_keys(&self, x: &K) -> Result<usize, usize>where
K: Ord,
pub fn binary_search_keys(&self, x: &K) -> Result<usize, usize>where
K: Ord,
Search over a sorted map for a key.
Returns the position where that key is present, or the position where it can be inserted to
maintain the sort. See slice::binary_search
for more details.
Computes in O(log(n)) time, which is notably less scalable than looking the key up
using get_index_of
, but this can also position missing keys.
Sourcepub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize>
pub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize>
Search over a sorted map with a comparator function.
Returns the position where that value is present, or the position where it can be inserted
to maintain the sort. See slice::binary_search_by
for more details.
Computes in O(log(n)) time.
Sourcepub fn binary_search_by_key<'a, B, F>(
&'a self,
b: &B,
f: F,
) -> Result<usize, usize>
pub fn binary_search_by_key<'a, B, F>( &'a self, b: &B, f: F, ) -> Result<usize, usize>
Search over a sorted map with an extraction function.
Returns the position where that value is present, or the position where it can be inserted
to maintain the sort. See slice::binary_search_by_key
for more details.
Computes in O(log(n)) time.
Sourcepub fn partition_point<P>(&self, pred: P) -> usize
pub fn partition_point<P>(&self, pred: P) -> usize
Returns the index of the partition point of a sorted map according to the given predicate (the index of the first element of the second partition).
See slice::partition_point
for more details.
Computes in O(log(n)) time.
Sourcepub fn as_slice(&self) -> &Slice<K, V>
pub fn as_slice(&self) -> &Slice<K, V>
Returns a slice of all the key-value pairs in the map.
Computes in O(1) time.
Sourcepub fn get_index(&self, index: usize) -> Option<(&K, &V)>
pub fn get_index(&self, index: usize) -> Option<(&K, &V)>
Get a key-value pair by index
Valid indices are 0 <= index < self.len()
.
Computes in O(1) time.
Sourcepub fn get_range<R>(&self, range: R) -> Option<&Slice<K, V>>where
R: RangeBounds<usize>,
pub fn get_range<R>(&self, range: R) -> Option<&Slice<K, V>>where
R: RangeBounds<usize>,
Returns a slice of key-value pairs in the given range of indices.
Valid indices are 0 <= index < self.len()
.
Computes in O(1) time.
Sourcepub fn par_keys(&self) -> ParKeys<'_, K, V>
pub fn par_keys(&self) -> ParKeys<'_, K, V>
Return a parallel iterator over the keys of the map.
While parallel iterators can process items in any order, their relative order
in the map is still preserved for operations like reduce
and collect
.
Sourcepub fn par_values(&self) -> ParValues<'_, K, V>
pub fn par_values(&self) -> ParValues<'_, K, V>
Return a parallel iterator over the values of the map.
While parallel iterators can process items in any order, their relative order
in the map is still preserved for operations like reduce
and collect
.
Trait Implementations§
Source§impl<N: Clone + Network> Clone for PuzzleSolutions<N>
impl<N: Clone + Network> Clone for PuzzleSolutions<N>
Source§fn clone(&self) -> PuzzleSolutions<N>
fn clone(&self) -> PuzzleSolutions<N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<N: Network> Debug for PuzzleSolutions<N>
impl<N: Network> Debug for PuzzleSolutions<N>
Source§impl<N: Network> Deref for PuzzleSolutions<N>
impl<N: Network> Deref for PuzzleSolutions<N>
Source§impl<'de, N: Network> Deserialize<'de> for PuzzleSolutions<N>
impl<'de, N: Network> Deserialize<'de> for PuzzleSolutions<N>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes the solutions from a JSON-string or buffer.
Source§impl<N: Network> Display for PuzzleSolutions<N>
impl<N: Network> Display for PuzzleSolutions<N>
Source§impl<N: Network> FromBytes for PuzzleSolutions<N>
impl<N: Network> FromBytes for PuzzleSolutions<N>
Source§impl<N: Network> FromStr for PuzzleSolutions<N>
impl<N: Network> FromStr for PuzzleSolutions<N>
Source§impl<N: Network> Serialize for PuzzleSolutions<N>
impl<N: Network> Serialize for PuzzleSolutions<N>
Source§impl<N: Network> ToBytes for PuzzleSolutions<N>
impl<N: Network> ToBytes for PuzzleSolutions<N>
impl<N: Eq + Network> Eq for PuzzleSolutions<N>
impl<N: Network> StructuralPartialEq for PuzzleSolutions<N>
Auto Trait Implementations§
impl<N> Freeze for PuzzleSolutions<N>
impl<N> RefUnwindSafe for PuzzleSolutions<N>where
N: RefUnwindSafe,
<N as Network>::BlockHash: RefUnwindSafe,
<N as Environment>::Projective: RefUnwindSafe,
impl<N> Send for PuzzleSolutions<N>
impl<N> Sync for PuzzleSolutions<N>
impl<N> Unpin for PuzzleSolutions<N>
impl<N> UnwindSafe for PuzzleSolutions<N>where
N: UnwindSafe,
<N as Network>::BlockHash: UnwindSafe,
<N as Environment>::Projective: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
fn take_from_value<D>(
value: &mut Value,
field: &str,
) -> Result<T, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
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>
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