Struct rlifesrc_lib::rules::NtLife

source ·
pub struct NtLife {
    b0: bool,
    s8: bool,
    symmetry: Symmetry,
    impl_table: Vec<ImplFlags>,
}
Expand description

Non-totalistic Life-like rules.

This includes any rule that can be converted to a non-totalistic Life-like rule: isotropic non-totalistic rules, non-isotropic rules, hexagonal rules, rules with von Neumann neighborhoods, etc.

Fields§

§b0: bool

Whether the rule contains B0.

§s8: bool

Whether the rule contains S8.

§symmetry: Symmetry

The symmetry of the rule.

§impl_table: Vec<ImplFlags>

An array of actions for all neighborhood descriptors.

Implementations§

source§

impl NtLife

source

pub fn new(b: &[u8], s: &[u8]) -> Self

Constructs a new rule from the b and s data.

source

fn init_symmetry(self, b: &[u8], s: &[u8]) -> Self

Deduces the symmetry of the rule

source

fn init_trans(self, b: &[u8], s: &[u8]) -> Self

Deduces the implication for the successor.

source

fn init_conflict(self) -> Self

Deduces the conflicts.

source

fn init_impl(self) -> Self

Deduces the implication for the cell itself.

source

fn init_impl_nbhd(self) -> Self

Deduces the implication for the neighbors.

Trait Implementations§

source§

impl Clone for NtLife

source§

fn clone(&self) -> NtLife

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl FromStr for NtLife

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(input: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl ParseNtLife for NtLife

A parser for the rule.

source§

fn from_bs(b: Vec<u8>, s: Vec<u8>) -> Self

Construct the rule from b / s data.
source§

fn parse_rule(input: &str) -> Result<Self, ParseRuleError>where Self: Sized,

The parser.
source§

impl Rule for NtLife

§

type Desc = NbhdDesc

The type of neighborhood descriptor of the rule. Read more
§

type IsGen = False

Whether the rule is a Generations rule.
source§

fn has_b0(&self) -> bool

Whether the rule contains B0. Read more
source§

fn has_b0_s8(&self) -> bool

Whether the rule contains both B0 and S8. Read more
source§

fn gen(&self) -> usize

The number of states.
source§

fn symmetry(&self) -> Symmetry

The symmetry of the rule.
source§

fn new_desc(state: State, succ_state: State) -> Self::Desc

Generates a neighborhood descriptor which says that all neighboring cells have states state, and the successor has state succ_state.
source§

fn update_desc(cell: &LifeCell<Self>, state: State, _new: bool)

Updates the neighborhood descriptors of all neighbors and the predecessor when the state of one cell is changed. Read more
source§

fn consistify<A: Algorithm<Self>>( world: &mut World<Self, A>, cell: CellRef<Self> ) -> Result<(), A::ConflReason>

Consistifies a cell. Read more
source§

impl Sealed for NtLife

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V