Trait BoundedParAccess

Source
pub unsafe trait BoundedParAccess<Index: Copy>: ParAccess<Index> {
    // Required method
    fn bounds(&self) -> Bounds<Index>;

    // Provided methods
    fn in_bounds(&self, index: Index) -> bool
       where Index: RecordIndex { ... }
    unsafe fn get_unsync(&self, index: Index) -> Self::Record
       where Index: RecordIndex { ... }
}
Expand description

Unsynchronized access to a bounded collection.

This trait allows a data structure that is structurally similar to a multidimensional array to describe its bounds, which enables use of the data structure with higher-level functionality in paradis.

§Safety

The bounds reported must be correct, in the sense that any index contained in the bounds may be used to access a valid record.

Required Methods§

Source

fn bounds(&self) -> Bounds<Index>

The bounds of this data structure.

§Safety

The bounds for a collection must never change while an access object still lives.

Provided Methods§

Source

fn in_bounds(&self, index: Index) -> bool
where Index: RecordIndex,

Determine if the provided index is in bounds.

Can be overridden by implementors for a simpler implementation than the default, which may aid the compiler in eliding bounds checks in situations where bounds may not be eliminated upfront.

Source

unsafe fn get_unsync(&self, index: Index) -> Self::Record
where Index: RecordIndex,

Unsynchronized mutable lookup of record.

The access is unsynchronized (and therefore unsafe), but bounds checked.

§Safety

See trait documentation.

§Panics

Panics if index is out of bounds.

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§