Skip to main content

ReadPlace

Trait ReadPlace 

Source
pub unsafe trait ReadPlace: PlaceHandle {
    const ACCESS: AccessKind;
    const SAFE: bool;

    // Required method
    unsafe fn read_place(self) -> Self::Target;
}
Expand description

let _ = place; – Read from a place.

Reading from a place doesn’t have any special syntax, instead a read can happens in many places. This occurs precisely when a place expression is used in a value context1. For example:

  • let _ = place;
  • match place { /* ... */ }
  • function(place)

When a place expression is being read, its handle must implement this trait. Additionally, the type stored in the place must be Copy, or the handle must also implement MovePlace. Otherwise a compiler error will be emitted that the value cannot be moved out.

Required Associated Constants§

Source

const ACCESS: AccessKind

The access permissions to the place required by Self::read_place.

Source

const SAFE: bool

Whether Self::read_place is safe when Self::ACCESS is honored.

This constant controls whether the compiler will require writing an unsafe block around reading from a place that uses this handle.

Required Methods§

Source

unsafe fn read_place(self) -> Self::Target

Read from the place.

§Safety

This handle must have Self::ACCESS permissions for the duration of this method call.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T> ReadPlace for *const T

Source§

const ACCESS: AccessKind = AccessKind::Untracked

Source§

const SAFE: bool = false

Source§

unsafe fn read_place(self) -> Self::Target

Source§

impl<T> ReadPlace for *mut T

Source§

const ACCESS: AccessKind = AccessKind::Untracked

Source§

const SAFE: bool = false

Source§

unsafe fn read_place(self) -> Self::Target

Source§

impl<T> ReadPlace for NonNull<T>

Source§

const ACCESS: AccessKind = AccessKind::Exclusive

Source§

const SAFE: bool = false

Source§

unsafe fn read_place(self) -> Self::Target

Implementors§

Source§

impl<'a, T> ReadPlace for RefHandle<'a, T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

impl<H> ReadPlace for PinnedHandle<H>
where H: ReadPlace, H::Target: Sized + Unpin,

Source§

const ACCESS: AccessKind = H::ACCESS

Source§

const SAFE: bool = H::SAFE

Source§

impl<T> ReadPlace for ArcRefHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

impl<T> ReadPlace for BoxHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

impl<T> ReadPlace for LocalHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

impl<T> ReadPlace for MutHandle<'_, T>

Source§

const ACCESS: AccessKind = AccessKind::Exclusive

Source§

const SAFE: bool = true