pub struct SquareBoardBuilder { /* private fields */ }Expand description
A builder for boards with square-shaped cells, i.e. the rectangular boards found in Numberlink puzzles and in Flow Free and the Bridges and Warps expansions.
Implementations§
Source§impl SquareBoardBuilder
impl SquareBoardBuilder
Sourcepub fn add_warp(
&mut self,
location: Location,
direction: Option<SquareStep>,
) -> &mut Self
pub fn add_warp( &mut self, location: Location, direction: Option<SquareStep>, ) -> &mut Self
Add a warp at the specified location pointing in direction.
A warp is located on one edge of the board and connects one cell to its partner on the opposite edge of the board along a cardinal direction.
Specifying direction necessary if and only if location is at a corner, in which case the direction is ambiguous.
If location is on an edge but not at a corner, direction is ignored regardless of whether it is specified.
May cause the builder to enter a FeatureOutOfBounds invalid state if location is out of bounds or not on an edge.
May cause the builder to enter a WarpBadDirection invalid state if location is at a corner and direction is missing or is impossible for a warp at this location.
If the builder is already in an invalid state, this function does nothing.
Trait Implementations§
Source§impl Builder<SquareStep> for SquareBoardBuilder
impl Builder<SquareStep> for SquareBoardBuilder
Source§fn with_dims(dims: (NonZero<usize>, NonZero<usize>)) -> Self
fn with_dims(dims: (NonZero<usize>, NonZero<usize>)) -> Self
Self with the specified dimensions, specified in (x, y) order.Source§fn add_termini(
&mut self,
display: char,
locations: (Location, Location),
) -> &mut Self
fn add_termini( &mut self, display: char, locations: (Location, Location), ) -> &mut Self
locations are specified does not matter. Read moreSource§fn pop_termini(&mut self) -> &mut Self
fn pop_termini(&mut self) -> &mut Self
Source§fn add_bridge(&mut self, location: Location) -> &mut Self
fn add_bridge(&mut self, location: Location) -> &mut Self
location. Read moreSource§fn drop_location(&mut self, location: Location) -> &mut Self
fn drop_location(&mut self, location: Location) -> &mut Self
Source§fn disconnect(&mut self, locations: UnorderedPair<Location>) -> &mut Self
fn disconnect(&mut self, locations: UnorderedPair<Location>) -> &mut Self
locations, i.e. place a wall between them. Read moreSource§fn disconnect_around(
&mut self,
location: Location,
directions: &Vec<SquareStep>,
) -> &mut Self
fn disconnect_around( &mut self, location: Location, directions: &Vec<SquareStep>, ) -> &mut Self
Self::disconnect, with the same conditions. Read moreSource§fn is_valid(&self) -> Option<&[BuilderInvalidReason]>
fn is_valid(&self) -> Option<&[BuilderInvalidReason]>
BuilderInvalidReason condition has arisen. Read moreSource§fn build(&self) -> Result<Board<SquareStep>, &[BuilderInvalidReason]>
fn build(&self) -> Result<Board<SquareStep>, &[BuilderInvalidReason]>
Board.
If the builder is invalid for any reason, a reference to a Vec of BuilderInvalidReason will indicate why.Source§impl Clone for SquareBoardBuilder
impl Clone for SquareBoardBuilder
Source§fn clone(&self) -> SquareBoardBuilder
fn clone(&self) -> SquareBoardBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SquareBoardBuilder
impl RefUnwindSafe for SquareBoardBuilder
impl Send for SquareBoardBuilder
impl Sync for SquareBoardBuilder
impl Unpin for SquareBoardBuilder
impl UnwindSafe for SquareBoardBuilder
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<Reference, Outer, OuterFieldType, Inner> HasPart<Nested<Outer, Inner>> for Reference
impl<Reference, Outer, OuterFieldType, Inner> HasPart<Nested<Outer, Inner>> for Reference
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