Struct kernel::ARef

source · []
pub struct ARef<T: AlwaysRefCounted> { /* private fields */ }
Expand description

An owned reference to an always-reference-counted object.

The object’s reference count is automatically decremented when an instance of ARef is dropped. It is also automatically incremented when a new instance is created via ARef::clone.

Invariants

The pointer stored in ptr is non-null and valid for the lifetime of the ARef instance. In particular, the ARef instance owns an increment on underlying object’s reference count.

Implementations

Creates a new instance of ARef.

It takes over an increment of the reference count on the underlying object.

Safety

Callers must ensure that the reference count was incremented at least once, and that they are properly relinquishing one increment. That is, if there is only one increment, callers must not use the underlying object anymore – it is only safe to do so via the newly created ARef.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

The resulting type after dereferencing.

Dereferences the value.

Executes the destructor for this type. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

This documentation is an old archive. Please see https://rust.docs.kernel.org instead.