Expand description
A projecting version of
Arc
which allows owning a containing struct but referencing a field.
Implementations
sourceimpl<'a, T: ?Sized, Owner: 'a + Sized> Arc<T, Owner>
impl<'a, T: ?Sized, Owner: 'a + Sized> Arc<T, Owner>
sourcepub fn erase_owner(this: Self) -> Arc<T, dyn Destruct + 'a>
pub fn erase_owner(this: Self) -> Arc<T, dyn Destruct + 'a>
Erases the owning type so projected Arc can be used uniformly.
sourceimpl<T: ?Sized, Owner: ?Sized> Arc<T, Owner>
impl<T: ?Sized, Owner: ?Sized> Arc<T, Owner>
sourcepub fn downgrade(this: &Self) -> Weak<T, Owner>
pub fn downgrade(this: &Self) -> Weak<T, Owner>
Creates a new Weak pointer to this projected field.
sourcepub fn owner(this: &Self) -> Arc<Owner>
pub fn owner(this: &Self) -> Arc<Owner>
Gets a reference to the owning allocation.
This returns a clone of the owning
Arc,
so it cannot return a unique reference. If you want to take
unique ownership, use into_owner instead.
sourcepub fn into_owner(this: Self) -> Arc<Owner>
pub fn into_owner(this: Self) -> Arc<Owner>
Consumes this projected field and returns the owning allocation.
sourceimpl<T: ?Sized, Owner: ?Sized> Arc<T, Owner>
impl<T: ?Sized, Owner: ?Sized> Arc<T, Owner>
sourcepub fn unsize<U: ?Sized, F>(this: Self, with: Coercion<T, U, F>) -> Arc<U, Owner>where
T: Sized,
F: FnOnce(*const T) -> *const U,
Available on crate feature unsize only.
pub fn unsize<U: ?Sized, F>(this: Self, with: Coercion<T, U, F>) -> Arc<U, Owner>where
T: Sized,
F: FnOnce(*const T) -> *const U,
unsize only.Convert this pointer with an unsizing coercion
(e.g. from T to dyn Trait or [T; N] to [T]).
sourcepub fn unsize_owner<Pwner: ?Sized, F>(
this: Self,
with: Coercion<Owner, Pwner, F>
) -> Arc<T, Pwner>where
Owner: Sized,
F: FnOnce(*const Owner) -> *const Pwner,
Available on crate feature unsize only.
pub fn unsize_owner<Pwner: ?Sized, F>(
this: Self,
with: Coercion<Owner, Pwner, F>
) -> Arc<T, Pwner>where
Owner: Sized,
F: FnOnce(*const Owner) -> *const Pwner,
unsize only.Convert this pointer with an unsizing coercion of the owner
(e.g. from T to dyn Trait or [T; N] to [T]).
Trait Implementations
sourceimpl<T, U: ?Sized, Owner: ?Sized> CoerciblePtr<U> for Arc<T, Owner>
Available on crate feature unsize only.
impl<T, U: ?Sized, Owner: ?Sized> CoerciblePtr<U> for Arc<T, Owner>
Available on crate feature
unsize only.type Pointee = T
type Pointee = T
The type we point to.
This influences which kinds of unsizing are possible. Read more
sourcefn as_sized_ptr(&mut self) -> *mut Self::Pointee
fn as_sized_ptr(&mut self) -> *mut Self::Pointee
Get the raw inner pointer.
sourceunsafe fn replace_ptr(self, ptr: *mut U) -> Self::Output
unsafe fn replace_ptr(self, ptr: *mut U) -> Self::Output
Replace the container inner pointer with an unsized version. Read more
sourceimpl<T: ?Sized, Owner: ?Sized> Error for Arc<T, Owner>where
T: Error,
Available on crate feature std only.
impl<T: ?Sized, Owner: ?Sized> Error for Arc<T, Owner>where
T: Error,
Available on crate feature
std only.sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
sourceimpl<T: ?Sized, Owner: ?Sized> Ord for Arc<T, Owner>where
T: Ord,
impl<T: ?Sized, Owner: ?Sized> Ord for Arc<T, Owner>where
T: Ord,
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<T: ?Sized, Owner: ?Sized> PartialEq<Arc<T, Owner>> for Arc<T, Owner>where
T: PartialEq,
impl<T: ?Sized, Owner: ?Sized> PartialEq<Arc<T, Owner>> for Arc<T, Owner>where
T: PartialEq,
sourceimpl<T: ?Sized, Owner: ?Sized> PartialOrd<Arc<T, Owner>> for Arc<T, Owner>where
T: PartialOrd,
impl<T: ?Sized, Owner: ?Sized> PartialOrd<Arc<T, Owner>> for Arc<T, Owner>where
T: PartialOrd,
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl<T: ?Sized, Owner: ?Sized> Eq for Arc<T, Owner>where
T: Eq,
impl<T: ?Sized, Owner: ?Sized> Send for Arc<T, Owner>where
Arc<T>: Send,
impl<T: ?Sized, Owner: ?Sized> Sync for Arc<T, Owner>where
Arc<T>: Sync,
impl<T: ?Sized, Owner: ?Sized> UnwindSafe for Arc<T, Owner>where
for<'a> &'a T: UnwindSafe,
Arc<Owner>: UnwindSafe,
Available on crate feature
std only.Auto Trait Implementations
impl<T: ?Sized, Owner: ?Sized> RefUnwindSafe for Arc<T, Owner>where
Owner: RefUnwindSafe,
T: RefUnwindSafe,
impl<T: ?Sized, Owner: ?Sized> Unpin for Arc<T, Owner>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more