#[repr(transparent)]pub struct ArcBorrow<'a, T: ?Sized> { /* private fields */ }
Expand description
Borrowed version of Arc
.
This type is guaranteed to have the same repr as &T
.
Implementations§
source§impl<'a, T: ?Sized> ArcBorrow<'a, T>
impl<'a, T: ?Sized> ArcBorrow<'a, T>
sourcepub fn downgrade(this: Self) -> &'a T
pub fn downgrade(this: Self) -> &'a T
Convert this borrowed pointer into a standard reference.
This gives you a long-lived reference, whereas dereferencing gives a temporary borrow.
sourcepub fn strong_count(this: Self) -> usize
pub fn strong_count(this: Self) -> usize
Get the number of strong owning pointers to this allocation.
sourcepub fn weak_count(this: Self) -> usize
pub fn weak_count(this: Self) -> usize
Get the number of weak owning pointers to this allocation.
sourcepub unsafe fn from_raw(ptr: *const T) -> Self
pub unsafe fn from_raw(ptr: *const T) -> Self
Construct a new ArcBorrow
from a raw pointer.
The raw pointer must have been previously returned by a call to
ArcBorrow<U>::into_raw
or Arc<U>::as_raw
where U
must have the same size and alignment as T
. This is trivially true
if U
is T
. Note that if U
is not T
, this is a pointer cast (transmute)
between the two types, and the types must be transmute-compatible.
Trait Implementations§
source§impl<T> Ord for ArcBorrow<'_, T>where
T: Ord,
impl<T> Ord for ArcBorrow<'_, T>where
T: Ord,
source§impl<T, O> PartialEq<O> for ArcBorrow<'_, T>where
O: Deref,
T: PartialEq<O::Target> + ?Sized,
impl<T, O> PartialEq<O> for ArcBorrow<'_, T>where
O: Deref,
T: PartialEq<O::Target> + ?Sized,
source§impl<T, O> PartialOrd<O> for ArcBorrow<'_, T>where
O: Deref,
T: PartialOrd<O::Target> + ?Sized,
impl<T, O> PartialOrd<O> for ArcBorrow<'_, T>where
O: Deref,
T: PartialOrd<O::Target> + ?Sized,
1.0.0 · source§fn 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 moresource§impl<T> ToSocketAddrs for ArcBorrow<'_, T>where
T: ToSocketAddrs + ?Sized,
impl<T> ToSocketAddrs for ArcBorrow<'_, T>where
T: ToSocketAddrs + ?Sized,
§type Iter = <T as ToSocketAddrs>::Iter
type Iter = <T as ToSocketAddrs>::Iter
Returned iterator over socket addresses which this type may correspond
to.
source§fn to_socket_addrs(&self) -> Result<T::Iter>
fn to_socket_addrs(&self) -> Result<T::Iter>
Converts this object to an iterator of resolved
SocketAddr
s. Read more