FromInnerPtr

Trait FromInnerPtr 

Source
pub trait FromInnerPtr<Data = f32, Radius = f32>: NativeIndex<Data, Radius> {
    // Required method
    unsafe fn from_inner_ptr(inner_ptr: *mut Self::Inner) -> Self;
}
Expand description

Trait for Faiss index types which can be built from a pointer to a native implementation.

Required Methods§

Source

unsafe fn from_inner_ptr(inner_ptr: *mut Self::Inner) -> Self

Create an index using the given pointer to a native object.

§Safety

inner_ptr must point to a valid, non-freed CPU index, and cannot be shared across multiple instances. The inner index must also be compatible with the target NativeIndex type according to the native class hierarchy. For example, creating an IndexImpl out of a pointer to FaissIndexFlatL2 is valid, but creating a FlatIndex out of a plain FaissIndex can cause undefined behavior.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§