pub struct Domain {
pub dims: Vec<Dim>,
pub mappings: Vec<Mapping>,
pub primary: Vec<usize>,
}Expand description
Where elements are: index space, and any number of mappings.
A domain keeps every mapping it was given (design doc 02, gate 2
default 2). One may be marked primary per dim; Domain::primary_for
returns it, falling back to the first mapping that covers the dim.
Fields§
§dims: Vec<Dim>§mappings: Vec<Mapping>§primary: Vec<usize>Indices into mappings marked primary. At most one per dim.
Implementations§
Source§impl Domain
impl Domain
pub fn new(dims: Vec<Dim>) -> Self
pub fn shape(&self) -> Vec<u64>
pub fn dim_index(&self, name: &str) -> Option<usize>
Sourcepub fn add_mapping(&mut self, mapping: Mapping) -> usize
pub fn add_mapping(&mut self, mapping: Mapping) -> usize
Add a mapping and return its index. Panics if it names a dim the domain does not have.
Sourcepub fn set_primary(&mut self, index: usize)
pub fn set_primary(&mut self, index: usize)
Mark a mapping primary for the dims it covers, replacing any other primary mapping on those dims.
Sourcepub fn mappings_for(&self, d: usize) -> impl Iterator<Item = (usize, &Mapping)>
pub fn mappings_for(&self, d: usize) -> impl Iterator<Item = (usize, &Mapping)>
Mappings that cover dim d.
Sourcepub fn primary_for(&self, d: usize) -> Option<&Mapping>
pub fn primary_for(&self, d: usize) -> Option<&Mapping>
The primary mapping for dim d.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Domain
impl !UnwindSafe for Domain
impl Freeze for Domain
impl Send for Domain
impl Sync for Domain
impl Unpin for Domain
impl UnsafeUnpin for Domain
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more