# Struct flechasdb::db::build::proto::DatabaseSerialize

source ·

    pub struct DatabaseSerialize<'a, T, VS>where
        VS: VectorSet<T>,{ /* private fields */ }

Expand description

Serializable form of `Database`.

## Methods from Deref<Target = Database<T, VS>>§

source

#### pub fn num_vectors(&self) -> usize

Returns the number of vectors in the database.

source

#### pub fn vector_size(&self) -> usize

Returns the vector size.

source

#### pub fn num_partitions(&self) -> usize

Returns the number of partitions.

source

#### pub fn num_divisions(&self) -> usize

Returns the number of subvector divisions.

source

#### pub fn subvector_size(&self) -> usize

Returns the size of a subvector.

source

#### pub fn num_clusters(&self) -> usize

Returns the number of clusters.

source

#### pub fn vector_ids(&self) -> impl Iterator<Item = &Uuid>

Returns an iterator of vector IDs.

source

#### pub fn partitions(&self) -> PartitionIter<'_, T, VS> ⓘ

Returns an iterator of partitions.

source

#### pub fn get_attribute<K>( &self, id: &Uuid, key: &K ) -> Result<Option<&AttributeValue>, Error>where String: Borrow<K>, K: Hash + Eq + ?Sized,

Returns the attribute value of a given vector.

Fails if no vector is associated with `id`.

source

#### pub fn query<V>( &self, v: &V, k: NonZeroUsize, nprobe: NonZeroUsize ) -> Result<Vec<QueryResult<T>>, Error>where V: AsSlice<T> + ?Sized,

Queries k-nearest neighbors (k-NN) of a given vector.

source

#### pub fn query_with_events<V, EventHandler>( &self, v: &V, k: NonZeroUsize, nprobe: NonZeroUsize, event: EventHandler ) -> Result<Vec<QueryResult<T>>, Error>where V: AsSlice<T> + ?Sized, EventHandler: FnMut(QueryEvent),

Queries k-nearest neighbors (k-NN) of a given vector.

## Trait Implementations§

source§

### impl<'a, T, VS> Deref for DatabaseSerialize<'a, T, VS>where VS: VectorSet<T>,

§

#### type Target = Database<T, VS>

The resulting type after dereferencing.
source§

#### fn deref(&self) -> &Self::Target

Dereferences the value.
source§

### impl<'a, VS> Serialize<Database> for DatabaseSerialize<'a, f32, VS>where VS: VectorSet<f32>,

source§

#### fn serialize(&self) -> Result<ProtosDatabase, Error>

Serializes as a message.

## Auto Trait Implementations§

§

### impl<'a, T, VS> RefUnwindSafe for DatabaseSerialize<'a, T, VS>where T: RefUnwindSafe, VS: RefUnwindSafe,

§

### impl<'a, T, VS> Send for DatabaseSerialize<'a, T, VS>where T: Sync, VS: Sync,

§

### impl<'a, T, VS> Sync for DatabaseSerialize<'a, T, VS>where T: Sync, VS: Sync,

§

### impl<'a, T, VS> Unpin for DatabaseSerialize<'a, T, VS>

§

### impl<'a, T, VS> UnwindSafe for DatabaseSerialize<'a, T, VS>where T: RefUnwindSafe, VS: RefUnwindSafe,

## Blanket Implementations§

source§

### impl<T> Any for Twhere T: 'static + ?Sized,

source§

#### fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more
source§

### impl<T> Borrow<T> for Twhere T: ?Sized,

source§

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

### impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

### impl<T> From<T> for T

source§

#### fn from(t: T) -> T

Returns the argument unchanged.

source§

### impl<T, U> Into<U> for Twhere U: From<T>,

source§

#### fn into(self) -> U

Calls `U::from(self)`.

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

source§

### impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

#### type Error = Infallible

The type returned in the event of a conversion error.
source§

#### fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

### impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

#### fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

### impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

#### fn vzip(self) -> V