Skip to main content

BorrowPlace

Trait BorrowPlace 

Source
pub unsafe trait BorrowPlace<Output>: PlaceHandle {
    type Timing: Timing;

    const ACCESS: AccessKind;
    const SAFE: bool;

    // Required method
    unsafe fn borrow(self) -> Output;
}
Expand description

&place/@place – Borrow a place as Output.

Borrowing a place creates a pointer to the place. This operation is generic over the resulting pointer type and borrowing the same place with many different pointer types is supported.

There are a few ways to spell borrowing a place:

  • &place and &mut place — resulting in Output = &_ and Output = &mut _ respectively,
  • &raw const place and &raw mut placeOutput = *const _ and Output = *mut _
  • @place and @<$ty> placeOutput = _ and Output = $ty

All of these are desugared to BorrowPlace::<Output>::borrow(handle!($place)). Where handle! is explained in the section on place expressions

Required Associated Constants§

Source

const ACCESS: AccessKind

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

Source

const SAFE: bool

Whether Self::borrow is safe when Self::ACCESS is honored for Self::Timing.

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

Required Associated Types§

Source

type Timing: Timing

The timing of the access permissions of Self::borrow.

Required Methods§

Source

unsafe fn borrow(self) -> Output

Borrow the place using Output.

§Safety

This handle must have Self::ACCESS permissions for the duration of Self::Timing.

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<'a, T: ?Sized> BorrowPlace<&'a T> for NonNull<T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = false

Source§

type Timing = Lifetime<'a>

Source§

unsafe fn borrow(self) -> &'a T

Source§

impl<'a, T: ?Sized> BorrowPlace<&'a mut T> for NonNull<T>

Source§

const ACCESS: AccessKind = AccessKind::Exclusive

Source§

const SAFE: bool = false

Source§

type Timing = Lifetime<'a>

Source§

unsafe fn borrow(self) -> &'a mut T

Source§

impl<T: ?Sized> BorrowPlace<*const T> for NonNull<T>

Source§

const ACCESS: AccessKind = AccessKind::Untracked

Source§

const SAFE: bool = true

Source§

type Timing = Instant

Source§

unsafe fn borrow(self) -> *const T

Source§

impl<T: ?Sized> BorrowPlace<*mut T> for NonNull<T>

Source§

const ACCESS: AccessKind = AccessKind::Untracked

Source§

const SAFE: bool = true

Source§

type Timing = Instant

Source§

unsafe fn borrow(self) -> *mut T

Source§

impl<T: ?Sized> BorrowPlace<NonNull<T>> for NonNull<T>

Source§

const ACCESS: AccessKind = AccessKind::Untracked

Source§

const SAFE: bool = true

Source§

type Timing = Instant

Source§

unsafe fn borrow(self) -> NonNull<T>

Implementors§

Source§

impl<'a, 'b, T> BorrowPlace<&'a mut T> for CellMutHandle<'b, T>
where 'b: 'a,

Source§

const ACCESS: AccessKind = AccessKind::Exclusive

Source§

const SAFE: bool = true

Source§

type Timing = Lifetime<'a>

Source§

impl<'a, 'b, T> BorrowPlace<&'b T> for RefHandle<'a, T>
where 'a: 'b,

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

type Timing = Lifetime<'b>

Source§

impl<'a, 'b, T> BorrowPlace<&'b mut T> for MutHandle<'a, T>
where 'a: 'b,

Source§

const ACCESS: AccessKind = AccessKind::Exclusive

Source§

const SAFE: bool = true

Source§

type Timing = Lifetime<'b>

Source§

impl<'a, 'b, T> BorrowPlace<RefMut<'a, T>> for CellMutHandle<'b, T>
where 'b: 'a,

Source§

const ACCESS: AccessKind = AccessKind::Exclusive

Source§

const SAFE: bool = true

Source§

type Timing = Lifetime<'b>

Source§

impl<'a, T: ?Sized> BorrowPlace<&'a T> for ArcHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

type Timing = Lifetime<'a>

Source§

impl<'a, T: ?Sized> BorrowPlace<&'a T> for ArcRefHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

type Timing = Lifetime<'a>

Source§

impl<'a, T: ?Sized> BorrowPlace<&'a mut T> for BoxHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Exclusive

Source§

const SAFE: bool = true

Source§

type Timing = Lifetime<'a>

Source§

impl<'a, T> BorrowPlace<&'a T> for LocalHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

type Timing = Lifetime<'a>

Source§

impl<'a, T> BorrowPlace<&'a [T]> for VecHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

type Timing = Lifetime<'a>

Source§

impl<'a, T> BorrowPlace<&'a mut T> for LocalHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Exclusive

Source§

const SAFE: bool = true

Source§

type Timing = Lifetime<'a>

Source§

impl<H, Output> BorrowPlace<Pin<Output>> for PinnedHandle<H>
where H: BorrowPlace<Output>,

Source§

const ACCESS: AccessKind = H::ACCESS

Source§

const SAFE: bool = H::SAFE

Source§

type Timing = <H as BorrowPlace<Output>>::Timing

Source§

impl<T: ?Sized> BorrowPlace<*const T> for ArcHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

type Timing = Instant

Source§

impl<T: ?Sized> BorrowPlace<*const T> for ArcRefHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

type Timing = Instant

Source§

impl<T: ?Sized> BorrowPlace<ArcRef<T>> for ArcHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

type Timing = Instant

Source§

impl<T: ?Sized> BorrowPlace<ArcRef<T>> for ArcRefHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

type Timing = Instant

Source§

impl<T: ?Sized> BorrowPlace<NonNull<T>> for ArcHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

type Timing = Instant

Source§

impl<T: ?Sized> BorrowPlace<NonNull<T>> for ArcRefHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Shared

Source§

const SAFE: bool = true

Source§

type Timing = Instant

Source§

impl<T> BorrowPlace<*const T> for LocalHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Untracked

Source§

const SAFE: bool = true

Source§

type Timing = Instant

Source§

impl<T> BorrowPlace<*mut T> for LocalHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Untracked

Source§

const SAFE: bool = true

Source§

type Timing = Instant

Source§

impl<T> BorrowPlace<NonNull<T>> for LocalHandle<T>

Source§

const ACCESS: AccessKind = AccessKind::Untracked

Source§

const SAFE: bool = true

Source§

type Timing = Instant