Lines Matching full:reference
3 //! Internal reference counting support.
5 //! Many C types already have their own reference counting mechanism (e.g. by storing a
6 //! `refcount_t`). This module provides support for directly using their internal reference count
7 //! from Rust; instead of making users have to use an additional Rust-reference count in the form of
12 //! implementation of the `get_` and `put_` pattern used in C for reference counting.
15 //! for accessing the internal reference count of an object of the `MyType` type.
22 /// Types that are _always_ reference counted.
25 /// Additionally, it allows users to convert from a shared reference `&T` to an owned reference
29 /// Rust code, the recommendation is to use [`Arc`](crate::sync::Arc) to create reference-counted
34 /// Implementers must ensure that increments to the reference count keep the object alive in memory
37 /// Implementers must also ensure that all instances are reference-counted. (Otherwise they
41 /// Increments the reference count on the object.
44 /// Decrements the reference count on the object.
50 /// Callers must ensure that there was a previous matching increment to the reference count,
51 /// and that the object is no longer used after its reference count is decremented (as it may
58 /// An owned reference to an always-reference-counted object.
60 /// The object's reference count is automatically decremented when an instance of [`ARef`] is
67 /// particular, the [`ARef`] instance owns an increment on the underlying object's reference count.
76 // mutable reference, for example, when the reference count reaches zero and `T` is dropped.
82 // `ARef<T>` on that thread, so the thread may ultimately access `T` using a mutable reference, for
83 // example, when the reference count reaches zero and `T` is dropped.
89 /// It takes over an increment of the reference count on the underlying object.
93 /// Callers must ensure that the reference count was incremented at least once, and that they
165 // SAFETY: The type invariants guarantee that the `ARef` owns the reference we're about to