Skip to main content

WaveOffsetCounter

Trait WaveOffsetCounter 

Source
pub trait WaveOffsetCounter: Default + Clone {
    type Offset;

    // Required methods
    fn count(&self, offset: &Self::Offset) -> usize;
    fn count_mut(&mut self, offset: &Self::Offset) -> &mut usize;
}
Expand description

A trait for counting types that store a usize for each of the offsets from some OffsetPosition type. During the wave function collapse process, these counts can be reduced as adjacent patterns possibilities are removed so that the algorithm can keep track of how many ways a pattern is possible. For a pattern to be possible, it must match some possible pattern in all offsets, so if any of these counts become 0 the algorithm will know to remove the corresponding pattern.

Required Associated Types§

Source

type Offset

The type that will be the index into the array of usize counts.

Required Methods§

Source

fn count(&self, offset: &Self::Offset) -> usize

The count for the given offset.

Source

fn count_mut(&mut self, offset: &Self::Offset) -> &mut usize

The count for the given offset.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§