pub struct Solution {
items: SolutionItemArray,
}
Expand description
Potential solution to an EquiX puzzle
The Solution
type itself verifies the well-formedness of an Equi-X
solution, but not its suitability for a particular challenge string.
Fields§
§items: SolutionItemArray
Inner fixed-sized array of SolutionItem
Implementations§
Source§impl Solution
impl Solution
Sourcepub const NUM_BYTES: usize = 16usize
pub const NUM_BYTES: usize = 16usize
Number of bytes in the packed representation of a solution
Sourceconst ITEM_SIZE: usize = 2usize
const ITEM_SIZE: usize = 2usize
Size of each SolutionItem
, in bytes
Sourcepub fn try_from_array(items: &SolutionItemArray) -> Result<Self, Error>
pub fn try_from_array(items: &SolutionItemArray) -> Result<Self, Error>
Build a Solution
from an array of items, checking that
the solution is well-formed.
Sourcepub(crate) fn sort_from_array(items: SolutionItemArray) -> Self
pub(crate) fn sort_from_array(items: SolutionItemArray) -> Self
Build a Solution
by sorting a SolutionItemArray
as necessary,
without the possibility of failure.
Used by the solver.
Sourcepub fn try_from_bytes(bytes: &SolutionByteArray) -> Result<Self, Error>
pub fn try_from_bytes(bytes: &SolutionByteArray) -> Result<Self, Error>
Build a Solution
from a fixed size byte array, checking
that the solution is well-formed.
Sourcepub fn to_bytes(&self) -> SolutionByteArray
pub fn to_bytes(&self) -> SolutionByteArray
Return the packed byte representation of this Solution.
Trait Implementations§
Source§impl AsRef<[u16; 8]> for Solution
impl AsRef<[u16; 8]> for Solution
Source§fn as_ref(&self) -> &SolutionItemArray
fn as_ref(&self) -> &SolutionItemArray
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl From<Solution> for SolutionItemArray
impl From<Solution> for SolutionItemArray
Source§fn from(solution: Solution) -> SolutionItemArray
fn from(solution: Solution) -> SolutionItemArray
Converts to this type from the input type.
impl Eq for Solution
impl StructuralPartialEq for Solution
Auto Trait Implementations§
impl Freeze for Solution
impl RefUnwindSafe for Solution
impl Send for Solution
impl Sync for Solution
impl Unpin for Solution
impl UnwindSafe for Solution
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