pub struct RandomBoardGen<R: Rng> { /* private fields */ }Expand description
Random world map board generator
Implementations§
Source§impl RandomBoardGen<StdRng>
impl RandomBoardGen<StdRng>
Source§impl<R: Rng> RandomBoardGen<R>
impl<R: Rng> RandomBoardGen<R>
Sourcepub fn gen(
&mut self,
resolution: Option<Resolution>,
width: Option<usize>,
height: Option<usize>,
) -> Result<Board<'static>>
pub fn gen( &mut self, resolution: Option<Resolution>, width: Option<usize>, height: Option<usize>, ) -> Result<Board<'static>>
Most generic method to generate a random map. When resolution is None, the resolution is
determined from its size. When width and/or height are None they will be determined from
the terminal size. In the case, when terminal size cannot be obtained, this method returns
an error.
Sourcepub fn gen_auto(&mut self, width: usize, height: usize) -> Board<'static>
pub fn gen_auto(&mut self, width: usize, height: usize) -> Board<'static>
Generate a random map of given width and height. Resolution is automatically determined from its size.
- When width and height are lower than 15: low resolution
- When width and height are lower than 120: middle resolution
- Otherwise: high resolution
Sourcepub fn gen_small(&mut self, width: usize, height: usize) -> Board<'static>
pub fn gen_small(&mut self, width: usize, height: usize) -> Board<'static>
Generate a low resolution random map of given width and height.
Sourcepub fn gen_middle(&mut self, width: usize, height: usize) -> Board<'static>
pub fn gen_middle(&mut self, width: usize, height: usize) -> Board<'static>
Generate a middle resolution random map of given width and height.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for RandomBoardGen<R>where
R: Freeze,
impl<R> RefUnwindSafe for RandomBoardGen<R>where
R: RefUnwindSafe,
impl<R> Send for RandomBoardGen<R>where
R: Send,
impl<R> Sync for RandomBoardGen<R>where
R: Sync,
impl<R> Unpin for RandomBoardGen<R>where
R: Unpin,
impl<R> UnwindSafe for RandomBoardGen<R>where
R: 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
Mutably borrows from an owned value. Read more