pub struct UnsafeRef<T: ?Sized> { /* private fields */ }
Expand description

Unchecked shared pointer

This type acts like a Rc or Arc except that no reference count is maintained. Instead, the user is responsible for freeing the managed object once it is no longer in use.

You must guarantee that an object managed by an UnsafeRef is not moved, dropped or accessed through a mutable reference as long as at least one UnsafeRef is pointing to it.

Implementations

Creates an UnsafeRef from a raw pointer

Safety

You must ensure that the UnsafeRef guarantees are upheld.

Converts an UnsafeRef into a raw pointer

Creates an UnsafeRef from a Box

Converts an UnsafeRef into a Box

Safety

You must ensure that this is the only UnsafeRef managing this object and that it is not currently a member of any intrusive collections. This operation is only valid if the UnsafeRef was created using UnsafeRef::from_box.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.
Immutably borrows from an owned value. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Consumes the owned pointer and returns a raw pointer to the owned object. Read more
Constructs an owned pointer from a raw pointer which was previously returned by into_raw. Read more

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
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.