pub trait WfcConstrain {
type Offset;
type Pattern: Eq + Hash + Clone;
// Required methods
fn all_patterns(&self) -> impl Iterator<Item = &Self::Pattern>;
fn probability_of(&self, pattern: &Self::Pattern) -> f32;
fn is_legal(
&self,
from: &Self::Pattern,
offset: &Self::Offset,
to: &Self::Pattern,
) -> bool;
}Expand description
Trait for an object that specifies the rules by which wave function collapse tiles are chosen.
Required Associated Types§
Required Methods§
Sourcefn all_patterns(&self) -> impl Iterator<Item = &Self::Pattern>
fn all_patterns(&self) -> impl Iterator<Item = &Self::Pattern>
Iterator for all the patterns that wave function collapse is allowed to choose. Note that any pattern with a probability of 0.0 must not be included.
Sourcefn probability_of(&self, pattern: &Self::Pattern) -> f32
fn probability_of(&self, pattern: &Self::Pattern) -> f32
The probability of choosing a given pattern when there are no restrictions on patterns in any of the adjacent cells. This should be between 0.0 and 1.0.
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.