pub struct BoggleBuilder { /* private fields */ }
Expand description
The boggle board builder struct
Implementations§
Source§impl BoggleBuilder
impl BoggleBuilder
Sourcepub fn with_dictionary_path<P: Into<String>>(self, path: P) -> Self
pub fn with_dictionary_path<P: Into<String>>(self, path: P) -> Self
sets the trie dictionary text file path
Sourcepub fn with_target_score(self, score: isize) -> Self
pub fn with_target_score(self, score: isize) -> Self
sets the desired target score for the board to be generated
Sourcepub fn with_width(self, width: usize) -> Self
pub fn with_width(self, width: usize) -> Self
sets the board’s width
Sourcepub fn with_length(self, length: usize) -> Self
pub fn with_length(self, length: usize) -> Self
sets the board’s length
Sourcepub fn build(self) -> Result<Option<Board>, Error>
pub fn build(self) -> Result<Option<Board>, Error>
generates a boggle board instance
§Examples
use boggle_maker::BoggleBuilder;
let builder = BoggleBuilder::new()
.with_dictionary_path("words.txt")
.with_target_score(2500)
.with_length(4)
.with_width(4);
if let Some(board) = builder.build().expect("Failed to load trie from words.txt file"){
assert!(board.score().unwrap()>=2500);
}
else{
assert!(false);
}
Trait Implementations§
Source§impl Default for BoggleBuilder
impl Default for BoggleBuilder
Source§fn default() -> BoggleBuilder
fn default() -> BoggleBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for BoggleBuilder
impl RefUnwindSafe for BoggleBuilder
impl Send for BoggleBuilder
impl Sync for BoggleBuilder
impl Unpin for BoggleBuilder
impl UnwindSafe for BoggleBuilder
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> 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