Skip to main content

LocalHandle

Struct LocalHandle 

Source
pub struct LocalHandle<T: ?Sized> { /* private fields */ }
🔬This is a nightly-only experimental API. (field_projections #145383)
Expand description

Primitive handle referring to a local variable or memory location.

§Design Tradeoff & Intermediate Status

LocalHandle is an intermediate concrete handle introduced to enable developing, testing, and validating place projections (ProjectPlace) and subplaces (Subplace) prior to full compiler-native place support.

In the full Field Projections design:

  • Place capabilities and lifetimes are statically partitioned into dedicated handle types (e.g. MutHandle<'a, T> and RefHandle<'a, T>).
  • Access permissions are checked by the borrow checker through terminal operation traits (BorrowPlace, WritePlace, ReadPlace).

In this intermediate milestone:

  • LocalHandle<T> acts as a unified concrete handle storing a *mut T.
  • Shared versus exclusive access permissions are not separated into distinct types; callers must uphold unsafe preconditions when obtaining or mutating through raw pointers via as_mut_ptr.

Implementations§

Source§

impl<T: ?Sized> LocalHandle<T>

Source

pub const fn as_ptr(&self) -> *const T

🔬This is a nightly-only experimental API. (field_projections #145383)

Obtains a const raw pointer to the place.

Source

pub const fn as_mut_ptr(&self) -> *mut T

🔬This is a nightly-only experimental API. (field_projections #145383)

Obtains a mutable raw pointer to the place.

Trait Implementations§

Source§

impl<T: ?Sized> Clone for LocalHandle<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)
where Self:,

Performs copy-assignment from source. Read more
Source§

impl<T: ?Sized> Copy for LocalHandle<T>

Source§

impl<T: ?Sized> Debug for LocalHandle<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, T: ?Sized> DerefPlace for LocalHandle<&'a mut T>

Source§

type PointeeHandle = MutHandle<'a, T>

🔬This is a nightly-only experimental API. (field_projections #145383)
Source§

unsafe fn deref_place(self) -> Self::PointeeHandle

🔬This is a nightly-only experimental API. (field_projections #145383)
Source§

impl<'a, T: ?Sized> DerefPlace for LocalHandle<&'a T>

Source§

type PointeeHandle = RefHandle<'a, T>

🔬This is a nightly-only experimental API. (field_projections #145383)
Source§

unsafe fn deref_place(self) -> Self::PointeeHandle

🔬This is a nightly-only experimental API. (field_projections #145383)
Source§

impl<T: ?Sized> DerefPlace for LocalHandle<*mut T>

Source§

type PointeeHandle = LocalHandle<T>

🔬This is a nightly-only experimental API. (field_projections #145383)
Source§

unsafe fn deref_place(self) -> Self::PointeeHandle

🔬This is a nightly-only experimental API. (field_projections #145383)
Source§

impl<T: ?Sized> DerefPlace for LocalHandle<*const T>

Source§

type PointeeHandle = LocalHandle<T>

🔬This is a nightly-only experimental API. (field_projections #145383)
Source§

unsafe fn deref_place(self) -> Self::PointeeHandle

🔬This is a nightly-only experimental API. (field_projections #145383)
Source§

impl<T: ?Sized> PlaceHandle for LocalHandle<T>

Source§

type Target = T

🔬This is a nightly-only experimental API. (field_projections #145383)
Source§

impl<S> ProjectPlace<S> for LocalHandle<S::Source>
where S: Subplace, S::Source: Sized, S::Target: Sized,

Source§

type Projected = LocalHandle<<S as Subplace>::Target>

🔬This is a nightly-only experimental API. (field_projections #145383)
Source§

unsafe fn project_place(self, subplace: S) -> Self::Projected

🔬This is a nightly-only experimental API. (field_projections #145383)

Auto Trait Implementations§

§

impl<T> !Send for LocalHandle<T>

§

impl<T> !Sync for LocalHandle<T>

§

impl<T> Forget for LocalHandle<T>
where T: ?Sized,

§

impl<T> Freeze for LocalHandle<T>
where *mut T: Freeze, T: ?Sized,

§

impl<T> Move for LocalHandle<T>
where *mut T: Move, T: ?Sized,

§

impl<T> RefUnwindSafe for LocalHandle<T>
where T: RefUnwindSafe + ?Sized,

§

impl<T> Unpin for LocalHandle<T>
where *mut T: Unpin, T: ?Sized,

§

impl<T> UnsafeUnpin for LocalHandle<T>
where *mut T: UnsafeUnpin, T: ?Sized,

§

impl<T> UnwindSafe for LocalHandle<T>
where *mut T: UnwindSafe, T: ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit #126799)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.