Skip to main content

IndexPlace

Trait IndexPlace 

Source
pub unsafe trait IndexPlace<Idx, H, PointeeTiming, PointerTiming>: Indexable<Idx>
where H: PlaceHandle<Target = Self>, PointeeTiming: Timing, PointerTiming: Timing,
{ type ElementHandle: PlaceHandle<Target = Self::Element>; const POINTEE_ACCESS: AccessKind; const POINTER_ACCESS: AccessKind; const SAFE: bool; // Required method fn index(handle: H, idx: Idx) -> Self::ElementHandle; }
Expand description

place[idx] – Index into Self via the handle H.

The same way that Indexable is the generic version of PlaceProxy, this trait is the generic version of DerefPlace.

Indexing – like dereferencing – also performs two accesses from the borrow-checker’s perspective:

  • the place that comes out of the index operation (place[idx]), and
  • the place that is being indexed into (place).

For this reason, there are two AccessKind constants and two Timing generics, see the documentation of DerefPlace for more information about them.

Required Associated Constants§

Source

const POINTEE_ACCESS: AccessKind

The access permissions to the contents of the place handled by Self required by Self::index.

Source

const POINTER_ACCESS: AccessKind

The access permissions to the place handled by Self required by Self::index.

Source

const SAFE: bool

Whether Self::index is safe when Self::POINTEE_ACCESS and Self::POINTER_ACCESS are honored for PointeeTiming and PointerTiming respectively.

This constant controls whether the compiler will require writing an unsafe block around indexing into a place that uses the H handle.

Required Associated Types§

Source

type ElementHandle: PlaceHandle<Target = Self::Element>

The type of handles to indexed elements.

Required Methods§

Source

fn index(handle: H, idx: Idx) -> Self::ElementHandle

Indexes into the value stored at H.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§