Struct cellular_automaton::Automaton[][src]

pub struct Automaton { /* fields omitted */ }
Expand description

A two-dimensional cellular automaton with a finite grid of cells.

Implementations

Constructs a new automaton with all cell states set to 0.

Examples

todo!();

Resizes the automaton so that cols is equal to width.

If width is greater than cols, the automaton’s rows are extended by the difference, with each additional column filled with 0. If width is less than cols, the automaton’s rows are simply truncated.

Examples

todo!();

Resizes the automaton so that rows is equal to height.

If height is greater than rows, the automaton’s columns are extended by the difference, with each additional row filled with 0. If height is less than rows, the automaton’s columns are simply truncated.

Examples

todo!();

Returns a raw pointer to the automaton cells’ buffer.

Examples

todo!();

Toggles the state of a cell. If the cell state is 0, it is set to 1. If the cell is any other state, it is set to 0.

Examples

todo!();

Sets the state of cells in locations to 1.

locations is a list of alternating row and column coordinates. This function is implemented with an array as the parameter because wasm_bindgen does not support nested arrays.

Examples

todo!();

Sets the cell state of all the automaton’s cells to n.

Only changes the automaton if n is less than or equal to the generation rule.

Examples

todo!();

Randomizes the cell state of all the automaton’s cells.

Loops through the automaton’s cells and if rand::random() is less than the percentage n, the cell state is set to 1.

Examples

todo!();

Sets all three cell state rules to different values.

Examples

todo!();

Sets the cell survival rule to a different value.

Examples

todo!();

Sets the cell birth rule to a different value.

Examples

todo!();

Sets the cell generation rule to a different value.

Examples

todo!();

Calculates and the state of all cells in the automaton after n generations

Examples

todo!();

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more

Recover a Self from Self::Abi. Read more

The wasm ABI type that this converts into when crossing the ABI boundary. Read more

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary. Read more

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi. Read more

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

The wasm ABI type references to Self are recovered from.

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous. Read more

Recover a Self::Anchor from Self::Abi. Read more

Same as RefFromWasmAbi::Abi

Same as RefFromWasmAbi::Anchor

Same as RefFromWasmAbi::ref_from_abi

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Same as IntoWasmAbi::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.