[−][src]Struct conway::universe::BigBang
Builder paradigm to create Universe
structs with default values.
Methods
impl BigBang
[src]
This is a builder for Universe
structs.
Examples
let mut uni = conway::universe::BigBang::new() .width(512) // optionally override width .height(256) // optionally override height .fog_radius(16) // optionally override fog radius .birth() .unwrap();
pub fn new() -> BigBang
[src]
Creates and returns a new builder.
pub fn width(self, new_width: usize) -> BigBang
[src]
Update the total number of columns for this Universe
pub fn height(self, new_height: usize) -> BigBang
[src]
Update the total number of rows for this Universe
pub fn server_mode(self, is_server: bool) -> BigBang
[src]
Determines whether we are running a Server or a Client.
true
- Serverfalse
- Client
pub fn history(self, history_depth: usize) -> BigBang
[src]
This records the number of generations that will be buffered.
pub fn add_player(self, new_player: PlayerBuilder) -> BigBang
[src]
This will add a single player to the list of players. Each player is responsible for providing their details through the PlayerBuilder.
Panics
Panics if, after adding this player, the length of the internal player_writable
vector
does not match the number of players.
pub fn add_players(self, new_player_list: Vec<PlayerBuilder>) -> BigBang
[src]
Adds a vector of players using add_player
method.
Panics
Panics if, after adding these players, the length of the internal player_writable
vector
does not match the number of players.
pub fn fog_radius(self, new_radius: usize) -> BigBang
[src]
Updates the fog to a new visibility radius. This is used to grant players visibility into the fog when they are competing against other players and they create cells outside of their own writiable regions.
pub fn birth(&self) -> ConwayResult<Universe>
[src]
"Gives life to the universe and the first moment of time." Creates a Universe which can then CGoL process generations.
Errors
- if
width
orheight
are not positive, or ifwidth
is not a multiple of 64. - if
fog_radius
is not positive. - if
history
is not positive.
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,