Struct Loop

Source
pub struct Loop<'a, S>
where S: Sim<'a>,
{ /* private fields */ }

Implementations§

Source§

impl<'a, S> Loop<'a, S>
where S: Sim<'a>,

Source

pub fn new<C>(coloration: C) -> Self
where C: Fn(&S::Cell) -> [f32; 3] + Sync + 'static,

Must pass the function that colors cells. Color is in RGB ([red, green, blue]).

Source

pub fn new_bool() -> Self
where S: Sim<'a, Cell = bool>,

Source

pub fn scale(&mut self, scale: f32) -> &mut Self

Source

pub fn filter<F>(&mut self, filter: F) -> &mut Self
where F: Fn(&S::Cell) -> bool + Sync + 'static,

Source

pub fn run(&self, grid: SquareGrid<'a, S>)

Source

pub unsafe fn run_multi<I0: Read, I1: Read, I2: Read, I3: Read, I4: Read, I5: Read, I6: Read, I7: Read, O0: Write, O1: Write, O2: Write, O3: Write, O4: Write, O5: Write, O6: Write, O7: Write>( &self, grid: SquareGrid<'a, S>, in_right: I0, in_up_right: I1, in_up: I2, in_up_left: I3, in_left: I4, in_down_left: I5, in_down: I6, in_down_right: I7, out_right: O0, out_up_right: O1, out_up: O2, out_up_left: O3, out_left: O4, out_down_left: O5, out_down: O6, out_down_right: O7, )
where S: 'a, for<'dc> S::Cell: Sync + Send + Serialize + Deserialize<'dc>, S::Move: Sync + Send, S::Diff: Sync + Send, S::Neighbors: Sync + Send, S::MoveNeighbors: Sync + Send, SquareGrid<'a, S>: TakeMoveNeighbors<usize, S::MoveNeighbors> + GetNeighbors<'a, usize, S::Neighbors>,

Runs serializing and deserializing to and from another run_multi. As soon as any read or write fails this will terminate without prompting.

Make sure the reads and writes are only connected to other SquareGrid::run_multi running on any machine using THE EXACT SAME simulation or else there may be undefined behavior.

Auto Trait Implementations§

§

impl<'a, S> Freeze for Loop<'a, S>

§

impl<'a, S> !RefUnwindSafe for Loop<'a, S>

§

impl<'a, S> !Send for Loop<'a, S>

§

impl<'a, S> Sync for Loop<'a, S>

§

impl<'a, S> Unpin for Loop<'a, S>

§

impl<'a, S> !UnwindSafe for Loop<'a, S>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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<T> Erased for T