pub struct HybridRc<T: ?Sized, State: RcState> { /* private fields */ }
Expand description
A hybrid reference-counting pointer.
HybridRc<T, Shared>
behaves mostly likestd::sync::Arc
HybridRc<T, Local>
behaves mostly likestd::rc::Rc
.
See the module-level documentation for more details.
The inherent methods of HybridRc
are all associated functions, which means that you have to
call them as e.g. HybridRc::get_mut(&mut x)
instead of x.get_mut()
. This avoids conflicts
with methods of the inner type T
.
Implementations
sourceimpl<T: ?Sized, State: RcState> HybridRc<T, State>
impl<T: ?Sized, State: RcState> HybridRc<T, State>
sourcepub unsafe fn get_mut_unchecked(this: &mut Self) -> &mut T
pub unsafe fn get_mut_unchecked(this: &mut Self) -> &mut T
Returns a mutable reference to the value, without checking for uniqueness.
See also
get_mut()
, which is safe.
Safety
No other HybridRc
or Weak
for the same value must be dereferenced for the duration of
the returned borrow.
Example
use hybrid_rc::Rc;
let mut a = Rc::new([1, 2, 3]);
// We know that there can't be any other references yet, so getting a mutable reference
// is safe here:
let mut_ref = unsafe { Rc::get_mut_unchecked(&mut a) };
mut_ref[0] = 42;
assert_eq!(a[..], [42, 2, 3]);
sourcepub fn get_mut(this: &mut Self) -> Option<&mut T>
pub fn get_mut(this: &mut Self) -> Option<&mut T>
Returns a mutable reference to the value, iff the value is not shared
with another HybridRc
or Weak
.
Returns None
otherwise.
sourcepub fn as_ptr(this: &Self) -> *const T
pub fn as_ptr(this: &Self) -> *const T
Provides a raw pointer to the referenced value
The counts are not affected in any way and the HybridRc
is not consumed.
The pointer is valid for as long there exists at least one HybridRc
for the value.
sourcepub fn into_raw(this: Self) -> *const T
pub fn into_raw(this: Self) -> *const T
Consumes the HybridRc<T, State>
, returning the wrapped pointer.
To avoid a memory leak the pointer must be converted back to a HybridRc
using
HybridRc<T, State>::from_raw()
.
sourcepub unsafe fn from_raw(ptr: *const T) -> Self
pub unsafe fn from_raw(ptr: *const T) -> Self
Reconstructs a HybridRc<T, State>
from a raw pointer.
Creates a HybridRc<T, State>
from a pointer that has been previously returned by
a call to into_raw()
.
Safety
The raw pointer must have been previously returned by a call to
HybridRc<T, State>
for the same State
and the same T
or another
compatible type that has the same size and alignment. The latter case amounts to
mem::transmute()
and is likely to produce undefined behaviour if not handled correctly.
The value must not have been dropped yet.
sourcepub fn downgrade_pin(this: &Pin<Self>) -> PinWeak<T>
pub fn downgrade_pin(this: &Pin<Self>) -> PinWeak<T>
sourcepub fn ptr_eq<S: RcState>(this: &Self, other: &HybridRc<T, S>) -> bool
pub fn ptr_eq<S: RcState>(this: &Self, other: &HybridRc<T, S>) -> bool
Checks if two HybridRc
s point to the same allocation.
sourcepub fn ptr_eq_pin<S: RcState>(
this: &Pin<Self>,
other: &Pin<HybridRc<T, S>>
) -> bool
pub fn ptr_eq_pin<S: RcState>(
this: &Pin<Self>,
other: &Pin<HybridRc<T, S>>
) -> bool
Checks if two pinned HybridRc
s point to the same allocation.
sourcepub fn strong_count(this: &Self) -> usize
pub fn strong_count(this: &Self) -> usize
Gets the approximate number of strong pointers to the inner value.
As shared pointers cannot access the local reference counter, Arc::strong_count()
only
provides a lower bound on the reference count at the moment of the call.
Please also understand that, if the count is greater than one, another thread might change the count at any time, including potentially between calling this method and acting on the result.
Examples
use hybrid_rc::{Rc, Arc};
let reference = Rc::new(42);
let _2nd_ref = Rc::clone(&reference);
let shared_ref = Rc::to_shared(&reference);
let _2nd_shared_ref = Arc::clone(&shared_ref);
assert_eq!(Rc::strong_count(&reference), 4);
// shared_ref only knows the count of shared references and that there is at least one
// local reference, so it will show 3 instead of 4:
assert_eq!(Arc::strong_count(&shared_ref), 3);
sourcepub fn strong_count_pin(this: &Pin<Self>) -> usize
pub fn strong_count_pin(this: &Pin<Self>) -> usize
Gets the approximate number of strong pointers to the pinned inner value.
sourcepub fn weak_count(this: &Self) -> usize
pub fn weak_count(this: &Self) -> usize
Gets the number of Weak
pointers to this allocation.
Please understand that another thread may change the weak count at any time, including potentially between calling this method and acting on the result.
Examples
use hybrid_rc::{Rc, Weak};
let reference = Rc::new(42);
let weak = Rc::downgrade(&reference);
let _weak_2 = weak.clone();
assert_eq!(Rc::weak_count(&reference), 2);
sourcepub fn weak_count_pin(this: &Pin<Self>) -> usize
pub fn weak_count_pin(this: &Pin<Self>) -> usize
Gets the number of PinWeak
pointers to the pinned inner value.
sourceimpl<T, State: RcState> HybridRc<T, State>
impl<T, State: RcState> HybridRc<T, State>
sourcepub fn new(data: T) -> Self
pub fn new(data: T) -> Self
Creates a new Rc<T>
, moving data
into a reference counted allocation.
If State
is Local
, the shared value is initially owned by the calling thread, so
for another thread to assume ownership to_shared()
must be used and all Rc
s for
the value must be dropped.
If State
is Shared
, initially the shared value has no owner thread, so any thread may
call to_local()
to assume ownership.
Examples
use hybrid_rc::Rc;
let rc = Rc::new(42i32);
// Cannot be used in another thread without using rc.to_shared()
std::thread::spawn(move || *rc).join(); // does not compile
use hybrid_rc::Arc;
let arc = Arc::new(42i32);
std::thread::spawn(move || assert!(*arc == 42)).join()?;
sourcepub fn new_uninit() -> HybridRc<MaybeUninit<T>, State>
pub fn new_uninit() -> HybridRc<MaybeUninit<T>, State>
Creates a new HybridRc
with uninitialized contents.
sourcepub fn new_zeroed() -> HybridRc<MaybeUninit<T>, State>
pub fn new_zeroed() -> HybridRc<MaybeUninit<T>, State>
Creates a new HybridRc
with uninitialized contents, with the memory being filled with
0 bytes.
See MaybeUninit::zeroed()
for examples of correct and incorrect usage of this method.
sourcepub fn new_cyclic(data_fn: impl FnOnce(&Weak<T>) -> T) -> HybridRc<T, State>
pub fn new_cyclic(data_fn: impl FnOnce(&Weak<T>) -> T) -> HybridRc<T, State>
Creates a new HybridRc
with a possibly cyclic reference.
For this a reference to a Weak
is passed to the closure that – after this function
returns – will point to the new value itself. Attempting to upgrade the weak reference
before new_cyclic
returns will result in a ValueDropped
error. However, the weak
reference may be cloned freely and stored for use at a later time.
sourcepub fn pin(data: T) -> Pin<Self>
pub fn pin(data: T) -> Pin<Self>
Creates a new Pin<HybridRc<T>>
. If T
does not implement Unpin
, then data
will be
pinned in memory and unable to be moved.
sourcepub fn try_new(data: T) -> Result<Self, AllocError>
pub fn try_new(data: T) -> Result<Self, AllocError>
Tries to creates a new Rc<T>
, moving data
into a reference counted allocation.
Errors
Will drop data
and return Err(
AllocError
)
if the allocation fails.
Please note that the global allocator on some systems may instead abort the process if an allocation failure happens.
sourcepub fn try_new_uninit() -> Result<HybridRc<MaybeUninit<T>, State>, AllocError>
pub fn try_new_uninit() -> Result<HybridRc<MaybeUninit<T>, State>, AllocError>
Tries to construct a new HybridRc
with uninitialized contents.
Errors
Will return Err(
AllocError
)
if the allocation fails.
Please note that the global allocator on some systems may instead abort the process if an allocation failure happens.
sourcepub fn try_new_zeroed() -> Result<HybridRc<MaybeUninit<T>, State>, AllocError>
pub fn try_new_zeroed() -> Result<HybridRc<MaybeUninit<T>, State>, AllocError>
Tries to construct a new HybridRc
with uninitialized contents, with the memory being
filled with 0 bytes.
See MaybeUninit::zeroed()
for examples of correct and incorrect usage of this method.
Errors
Will return Err(
AllocError
)
if the allocation fails.
Please note that the global allocator on some systems may instead abort the process if an allocation failure happens.
sourcepub fn try_unwrap(this: Self) -> Result<T, Self>
pub fn try_unwrap(this: Self) -> Result<T, Self>
Returns the inner value, if this HybridRc
is the only strong reference to it.
Any outstanding Weak
references won’t be able to upgrade anymore when this succeeds.
Errors
If this is not the only strong reference to the shared value, an Err
is returned with
the same HybridRc
that was passed in.
Examples
use hybrid_rc::Rc;
let reference = Rc::new(42);
let weak = Rc::downgrade(&reference);
let value = Rc::try_unwrap(reference).unwrap();
assert_eq!(value, 42);
assert!(weak.upgrade().is_err()); // Weaks cannot upgrade anymore.
sourceimpl<T, State: RcState> HybridRc<[T], State>
impl<T, State: RcState> HybridRc<[T], State>
sourcepub fn new_uninit_slice(len: usize) -> HybridRc<[MaybeUninit<T>], State>
pub fn new_uninit_slice(len: usize) -> HybridRc<[MaybeUninit<T>], State>
Creates a new reference-counted slice with uninitialized contents.
sourcepub fn new_zeroed_slice(len: usize) -> HybridRc<[MaybeUninit<T>], State>
pub fn new_zeroed_slice(len: usize) -> HybridRc<[MaybeUninit<T>], State>
Creates a new reference-counted slice with uninitialized contents, with the memory being filled with 0 bytes.
sourceimpl<T: Copy, State: RcState> HybridRc<[T], State>
impl<T: Copy, State: RcState> HybridRc<[T], State>
sourcepub fn copy_from_slice(src: &[T]) -> Self
pub fn copy_from_slice(src: &[T]) -> Self
Copies the contents of a slice into a new HybridRc
Optimization for copyable types. Will become deprecated once specialization is stablilized.
sourceimpl<T: ?Sized> HybridRc<T, Local>
impl<T: ?Sized> HybridRc<T, Local>
Creates a new shared reference (Arc
) for the referenced value.
Example
use hybrid_rc::{Rc, Arc};
let local = Rc::new(42i32);
let shared = Rc::to_shared(&local);
// `shared` can be safely transferred to another thread
std::thread::spawn(move || assert_eq!(*shared, 42i32)).join()?;
Creates a new pinned shared reference for the referenced value.
Example
use hybrid_rc::{Rc, Weak};
let strong = Rc::pin(42i32);
let shared = Rc::to_shared_pin(&strong);
assert!(Rc::ptr_eq_pin(&strong, &shared));
sourcepub unsafe fn increment_local_strong_count(ptr: *const T)
pub unsafe fn increment_local_strong_count(ptr: *const T)
Increments the local strong reference count on the Rc<T>
associated by the given pointer
Increases the local strong reference count as if a new Rc
was cloned and kept alive.
May panic in the unlikely case the platform-specific maximum for the reference count is
reached.
Safety
The pointer must have been obtained through HybridRc<T, Local>::into_raw()
, the value
must still be live and have a local strong count of at least 1 when this method is invoked
and this call must be performed on the same thread as where the original Rc
was created.
sourcepub unsafe fn decrement_local_strong_count(ptr: *const T)
pub unsafe fn decrement_local_strong_count(ptr: *const T)
Decrements the local strong reference count on the Rc<T>
associated by the given pointer
If the local strong reference counter reaches 0, the value is no longer considered owned by the calling thread and if there are no shared strong references to keep the value alive, it will be dropped.
Safety
The pointer must have been obtained through HybridRc<T, Local>::into_raw()
, the value
must still be live and have a local strong count of at least 1 when this method is invoked
and this call must be performed on the same thread as where the original Rc
was created.
sourceimpl<T: ?Sized> HybridRc<T, Shared>
impl<T: ?Sized> HybridRc<T, Shared>
sourcepub fn to_local(this: &Self) -> Option<Rc<T>>
pub fn to_local(this: &Self) -> Option<Rc<T>>
Creates a new local reference (Rc
) for the referenced value.
Returns None
if at least one Rc
already exists on another thread.
Note: In no_std
environments None
is returned if at least one Rc
exists on any
thread.
Example
use hybrid_rc::{Rc, Arc};
let local = Rc::new(42i32);
let shared = Rc::to_shared(&local);
// `shared` can be safely transferred to another thread
std::thread::spawn(move || assert_eq!(*shared, 42i32)).join()?;
sourcepub fn to_local_pin(this: &Pin<Self>) -> Option<Pin<Rc<T>>>
pub fn to_local_pin(this: &Pin<Self>) -> Option<Pin<Rc<T>>>
Creates a new pinned local reference for the referenced value.
Returns None
if at least one Rc
already exists on another thread.
Note: In no_std
environments None
is returned if at least one Rc
exists on any
thread.
Example
use hybrid_rc::{Arc, Weak};
let strong = Arc::pin(42i32);
let local = Arc::to_local_pin(&strong).unwrap();
assert!(Arc::ptr_eq_pin(&strong, &local));
Increments the shared strong reference count on the Arc<T>
associated by the given pointer
Increases the shared strong reference count as if a new Arc
was cloned and kept alive.
May panic in the unlikely case the platform-specific maximum for the reference count is
reached.
Safety
The pointer must have been obtained through HybridRc<T, Shared>::into_raw()
and the
value must still be live when this method is invoked.
Decrements the shared strong reference count on the Arc<T>
associated by the given pointer
If the shared strong reference counter (including the implicit shared reference for local strong references) reaches 0, the value will be dropped.
Safety
The pointer must have been obtained through HybridRc<T, Shared>::into_raw()
and the
value must still be live when this method is invoked.
sourceimpl<T: Clone, State: RcState> HybridRc<T, State>
impl<T: Clone, State: RcState> HybridRc<T, State>
sourcepub fn make_mut(this: &mut Self) -> &mut T
pub fn make_mut(this: &mut Self) -> &mut T
Makes a mutable reference into the given HybridRc
.
If there are other strong references to the same value, then make_mut()
will clone
the
inner value to a new allocation to ensure unique ownership. This is also referred to as
clone-on-write.
However, if there are no other strong references to this allocation, but some Weak
pointers, then the Weak
s will be disassociated and the inner value will not be cloned.
See also: get_mut()
, which will fail rather than cloning the inner value
or diassociating Weak
s.
Example
use hybrid_rc::Rc;
let mut reference = Rc::new(42);
*Rc::make_mut(&mut reference) += 2; // Won't clone anything
let mut reference_2 = Rc::clone(&reference); // Won't clone inner value
*Rc::make_mut(&mut reference) += 1; // Clones inner data
*Rc::make_mut(&mut reference) *= 2; // Won't clone anything
*Rc::make_mut(&mut reference_2) /= 4; // Won't clone anything
// Now `reference` and `reference_2` point to different allocations.
assert_eq!(*reference, 90);
assert_eq!(*reference_2, 11);
sourceimpl<T, State: RcState> HybridRc<MaybeUninit<T>, State>
impl<T, State: RcState> HybridRc<MaybeUninit<T>, State>
sourcepub unsafe fn assume_init(self) -> HybridRc<T, State>
pub unsafe fn assume_init(self) -> HybridRc<T, State>
Assumes the value is initialized and converts to HybridRc<T, State>
.
Safety
You need to provide the same guarantees as for MaybeUninit::assume_init()
.
Calling this when the value is not yet fully initialized causes immediate undefined
behavior.
Examples
use hybrid_rc::Rc;
let mut reference = Rc::<i64>::new_uninit();
let reference = unsafe {
// Deferred initialization
Rc::get_mut_unchecked(&mut reference).as_mut_ptr().write(1337);
reference.assume_init()
};
assert_eq!(*reference, 1337)
sourceimpl<T, State: RcState> HybridRc<[MaybeUninit<T>], State>
impl<T, State: RcState> HybridRc<[MaybeUninit<T>], State>
sourcepub unsafe fn assume_init(self) -> HybridRc<[T], State>
pub unsafe fn assume_init(self) -> HybridRc<[T], State>
Assumes the values are initialized and converts to HybridRc<[T], State>
.
Safety
You need to provide the same guarantees as for MaybeUninit::assume_init()
.
Calling this when the whole slice is not yet fully initialized causes immediate undefined
behavior.
sourceimpl<State: RcState> HybridRc<dyn Any, State>
impl<State: RcState> HybridRc<dyn Any, State>
sourcepub fn downcast<T: Any>(self) -> Result<HybridRc<T, State>, Self>
pub fn downcast<T: Any>(self) -> Result<HybridRc<T, State>, Self>
Tries to downcast the HybridRc<dyn Any, _>
to a concrete type.
Errors
If a downcast failed, the original HybridRc
is returned in Err
Example
use std::any::Any;
use std::mem::drop;
use hybrid_rc::Rc;
let value = 42i32;
let concrete = Rc::new(value);
let any: Rc<dyn Any> = Rc::into(concrete);
let any = any.downcast::<String>().unwrap_err();
assert_eq!(*any.downcast::<i32>().unwrap(), 42);
sourceimpl<State: RcState> HybridRc<dyn Any + Sync + Send, State>
impl<State: RcState> HybridRc<dyn Any + Sync + Send, State>
sourcepub fn downcast<T: Any + Sync + Send>(self) -> Result<HybridRc<T, State>, Self>
pub fn downcast<T: Any + Sync + Send>(self) -> Result<HybridRc<T, State>, Self>
Tries to downcast the HybridRc<dyn Any + Sync + Send, _>
to a concrete type.
Errors
If a downcast failed, the original HybridRc
is returned in Err
Example
use std::any::Any;
use std::mem::drop;
use hybrid_rc::Rc;
let value = 42i32;
let concrete = Rc::new(value);
let any: Rc<dyn Any + Sync + Send> = Rc::into(concrete);
let any = any.downcast::<String>().unwrap_err();
assert_eq!(*any.downcast::<i32>().unwrap(), 42);
Trait Implementations
sourceimpl<T: ?Sized> Clone for HybridRc<T, Local>
impl<T: ?Sized> Clone for HybridRc<T, Local>
sourcefn clone(&self) -> Self
fn clone(&self) -> Self
Creates another Rc
for the same value.
Example
use hybrid_rc::Rc;
let first = Rc::new(42i32);
let second = Rc::clone(&first);
assert_eq!(Rc::as_ptr(&first), Rc::as_ptr(&second));
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T: ?Sized> Clone for HybridRc<T, Shared>
impl<T: ?Sized> Clone for HybridRc<T, Shared>
sourcefn clone(&self) -> Self
fn clone(&self) -> Self
Creates another Arc
for the same value.
Example
use hybrid_rc::Arc;
let first = Arc::new(42i32);
let second = Arc::clone(&first);
assert_eq!(Arc::as_ptr(&first), Arc::as_ptr(&second));
let value = std::thread::spawn(move || *second)
.join()?;
assert_eq!(*first, value);
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a, T: ToOwned + ?Sized, State: RcState> From<Cow<'a, T>> for HybridRc<T, State> where
HybridRc<T, State>: From<&'a T> + From<T::Owned>,
impl<'a, T: ToOwned + ?Sized, State: RcState> From<Cow<'a, T>> for HybridRc<T, State> where
HybridRc<T, State>: From<&'a T> + From<T::Owned>,
sourceimpl<T, State: RcState, const N: usize> From<HybridRc<[T; N], State>> for HybridRc<[T], State>
impl<T, State: RcState, const N: usize> From<HybridRc<[T; N], State>> for HybridRc<[T], State>
sourceimpl<T: ?Sized> From<HybridRc<T, Local>> for HybridRc<T, Shared>
impl<T: ?Sized> From<HybridRc<T, Local>> for HybridRc<T, Shared>
sourcefn from(src: Rc<T>) -> Self
fn from(src: Rc<T>) -> Self
Converts an Rc<T>
into an Arc<T>
.
See to_shared()
.
sourceimpl<T: Any + 'static, State: RcState> From<HybridRc<T, State>> for HybridRc<dyn Any + 'static, State>
impl<T: Any + 'static, State: RcState> From<HybridRc<T, State>> for HybridRc<dyn Any + 'static, State>
sourceimpl<T: Any + Sync + Send + 'static, State: RcState> From<HybridRc<T, State>> for HybridRc<dyn Any + Sync + Send + 'static, State>
impl<T: Any + Sync + Send + 'static, State: RcState> From<HybridRc<T, State>> for HybridRc<dyn Any + Sync + Send + 'static, State>
sourceimpl<T, State: RcState> FromIterator<T> for HybridRc<[T], State>
impl<T, State: RcState> FromIterator<T> for HybridRc<[T], State>
sourcefn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Takes each element in the Iterator
and collects it into an HybridRc<[T], State>
.
Performance characteristics
Collecion is done by first collecting into a Vec<T>
.
This will allocate as many times as needed for constructing the Vec<T>
and then it will allocate once for turning the Vec<T>
into the HybridRc<[T], State>
.
Once specialization is stablilized this will be optimized for TrustedLen
iterators.
sourceimpl<T: ?Sized + Ord, State: RcState> Ord for HybridRc<T, State>
impl<T: ?Sized + Ord, State: RcState> Ord for HybridRc<T, State>
sourcefn cmp(&self, other: &Self) -> Ordering
fn cmp(&self, other: &Self) -> Ordering
Comparison for HybridRc
s.
The two are compared by calling cmp()
on their inner values.
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
sourceimpl<T: ?Sized + PartialEq, S1: RcState, S2: RcState> PartialEq<HybridRc<T, S2>> for HybridRc<T, S1>
impl<T: ?Sized + PartialEq, S1: RcState, S2: RcState> PartialEq<HybridRc<T, S2>> for HybridRc<T, S1>
sourceimpl<T: ?Sized + PartialOrd, S1: RcState, S2: RcState> PartialOrd<HybridRc<T, S2>> for HybridRc<T, S1>
impl<T: ?Sized + PartialOrd, S1: RcState, S2: RcState> PartialOrd<HybridRc<T, S2>> for HybridRc<T, S1>
sourcefn partial_cmp(&self, other: &HybridRc<T, S2>) -> Option<Ordering>
fn partial_cmp(&self, other: &HybridRc<T, S2>) -> Option<Ordering>
Partial comparison for HybridRc
s.
The two are compared by calling partial_cmp()
on their inner values.
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
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 more
sourceimpl<T, State: RcState, const N: usize> TryFrom<HybridRc<[T], State>> for HybridRc<[T; N], State>
impl<T, State: RcState, const N: usize> TryFrom<HybridRc<[T], State>> for HybridRc<[T; N], State>
impl<T: ?Sized + Eq, State: RcState> Eq for HybridRc<T, State>
impl<T: RefUnwindSafe> RefUnwindSafe for HybridRc<T, Shared>
impl<T: ?Sized + Sync + Send> Send for HybridRc<T, Shared>
impl<T: ?Sized + Sync + Send> Sync for HybridRc<T, Shared>
impl<T: ?Sized, State: RcState> Unpin for HybridRc<T, State>
HybridRc<T>
is always Unpin
itself, because the data value is on the heap,
so moving HybridRc<T>
doesn’t move the content even if T
is not Unpin
.
This allows unpinning e.g. Pin<Box<HybridRc<T>>>
but not any Pin<HybridRc<T>>
!
impl<T: RefUnwindSafe + ?Sized, State: RcState> UnwindSafe for HybridRc<T, State>
Auto Trait Implementations
impl<T, State> !RefUnwindSafe for HybridRc<T, State>
impl<T, State> !Send for HybridRc<T, State>
impl<T, State> !Sync for HybridRc<T, State>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more