Trait intrusive_collections::PointerOps

source ·
pub unsafe trait PointerOps {
    type Value: ?Sized;
    type Pointer;

    // Required methods
    unsafe fn from_raw(&self, value: *const Self::Value) -> Self::Pointer;
    fn into_raw(&self, ptr: Self::Pointer) -> *const Self::Value;
}
Expand description

Trait for pointer conversion operations.

Value is the actual object type managed by the collection. This type will typically have a link as a struct field.

Pointer is a pointer type which “owns” an object of type Value. Operations which insert an element into an intrusive collection will accept such a pointer and operations which remove an element will return this type.

Required Associated Types§

source

type Value: ?Sized

Object type which is inserted into an intrusive collection.

source

type Pointer

Pointer type which owns an instance of a value.

Required Methods§

source

unsafe fn from_raw(&self, value: *const Self::Value) -> Self::Pointer

Constructs an owned pointer from a raw pointer.

§Safety

The raw pointer must have been previously returned by into_raw.

An implementation of from_raw must not panic.

source

fn into_raw(&self, ptr: Self::Pointer) -> *const Self::Value

Consumes the owned pointer and returns a raw pointer to the owned object.

Implementors§