Trait faiss::index::FromInnerPtr

source ·
pub trait FromInnerPtr: NativeIndex {
    // Required method
    unsafe fn from_inner_ptr(inner_ptr: *mut FaissIndex) -> 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 FaissIndex) -> 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.

Implementors§