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§
Sourceconst ACCESS: AccessKind
const ACCESS: AccessKind
The access permissions to the place required by Self::read_place.
Sourceconst SAFE: bool
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§
Sourceunsafe fn read_place(self) -> Self::Target
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".