pub struct RcBorrow<'a, T: ?Sized> { /* private fields */ }Expand description
Borrowed version of Rc.
This type is guaranteed to have the same repr as &T.
Implementations§
Source§impl<'a, T: ?Sized> RcBorrow<'a, T>
impl<'a, T: ?Sized> RcBorrow<'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 RcBorrow from a raw pointer.
§Safety
The raw pointer must have been previously returned by a call to
RcBorrow<U>::into_raw or Rc<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> ErasablePtr for RcBorrow<'_, T>
impl<T> ErasablePtr for RcBorrow<'_, T>
Source§impl<T> Ord for RcBorrow<'_, T>where
T: Ord,
impl<T> Ord for RcBorrow<'_, T>where
T: Ord,
Source§impl<T, O> PartialOrd<O> for RcBorrow<'_, T>
impl<T, O> PartialOrd<O> for RcBorrow<'_, T>
Source§impl<T> ToSocketAddrs for RcBorrow<'_, T>where
T: ToSocketAddrs + ?Sized,
impl<T> ToSocketAddrs for RcBorrow<'_, T>where
T: ToSocketAddrs + ?Sized,
Source§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
SocketAddrs. Read moreimpl<T: ?Sized> Copy for RcBorrow<'_, T>
impl<T> Eq for RcBorrow<'_, T>
impl<'a, T: ?Sized> Send for RcBorrow<'a, T>
impl<'a, T: ?Sized> Sync for RcBorrow<'a, T>
impl<T: ?Sized> Unpin for RcBorrow<'_, T>
impl<T> UnwindSafe for RcBorrow<'_, T>where
T: RefUnwindSafe + ?Sized,
Auto Trait Implementations§
impl<'a, T> Freeze for RcBorrow<'a, T>where
T: ?Sized,
impl<'a, T> RefUnwindSafe for RcBorrow<'a, T>where
T: RefUnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more