Skip to main content

LocalHandle

Struct LocalHandle 

Source
pub struct LocalHandle<T>
where 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> LocalHandle<T>
where T: ?Sized,

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> Clone for LocalHandle<T>
where T: ?Sized,

Source§

fn clone(&self) -> LocalHandle<T>

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

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

Performs copy-assignment from source. Read more
Source§

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

Source§

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

Source§

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

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

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

Source§

type PointeeHandle = MutHandle<'a, T>

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

unsafe fn deref_place( self, ) -> <LocalHandle<&'a mut T> as DerefPlace>::PointeeHandle

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

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

Source§

type PointeeHandle = RefHandle<'a, T>

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

unsafe fn deref_place(self) -> <LocalHandle<&'a T> as DerefPlace>::PointeeHandle

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

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

Source§

type PointeeHandle = LocalHandle<T>

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

unsafe fn deref_place( self, ) -> <LocalHandle<*mut T> as DerefPlace>::PointeeHandle

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

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

Source§

type PointeeHandle = LocalHandle<T>

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

unsafe fn deref_place( self, ) -> <LocalHandle<*const T> as DerefPlace>::PointeeHandle

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

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

Source§

type Target = T

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

impl<S> ProjectPlace<S> for LocalHandle<<S as Subplace>::Source>
where S: Subplace, <S as Subplace>::Source: Sized, <S as Subplace>::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, ) -> <LocalHandle<<S as Subplace>::Source> as ProjectPlace<S>>::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 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.