Struct wfc::PatternDescription
source · pub struct PatternDescription {
pub weight: Option<NonZeroU32>,
pub allowed_neighbours: CardinalDirectionTable<Vec<PatternId>>,
}
Fields§
§weight: Option<NonZeroU32>
§allowed_neighbours: CardinalDirectionTable<Vec<PatternId>>
Implementations§
source§impl PatternDescription
impl PatternDescription
sourcepub fn new(
weight: Option<NonZeroU32>,
allowed_neighbours: CardinalDirectionTable<Vec<PatternId>>
) -> Self
pub fn new(
weight: Option<NonZeroU32>,
allowed_neighbours: CardinalDirectionTable<Vec<PatternId>>
) -> Self
Examples found in repository?
src/overlapping.rs (line 183)
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
pub fn pattern_descriptions(&self) -> PatternTable<PatternDescription> {
self.pattern_table
.iter()
.map(|pattern| {
let weight = NonZeroU32::new(pattern.count);
let mut allowed_neighbours = CardinalDirectionTable::default();
for direction in CardinalDirections {
allowed_neighbours[direction] = self
.compatible_patterns(pattern, direction)
.collect::<Vec<_>>();
}
PatternDescription::new(weight, allowed_neighbours)
})
.collect::<PatternTable<_>>()
}