VAddOptions

Struct VAddOptions 

Source
pub struct VAddOptions { /* private fields */ }
Available on crate feature vector-sets only.
Expand description

Options for the VADD command

§Example

use redis::{Commands, RedisResult, VAddOptions, VectorQuantization};
fn add_vector(
    con: &mut redis::Connection,
    key: &str,
    vector: &[f64],
    element: &str,
) -> RedisResult<bool> {
    let opts = VAddOptions::default()
        .set_reduction_dimension(5)
        .set_check_and_set_style(true)
        .set_quantization(VectorQuantization::Q8)
        .set_build_exploration_factor(300)
        .set_attributes(serde_json::json!({"name": "Vector attribute name", "description": "Vector attribute description"}))
        .set_max_number_of_links(16);
    con.vadd_options(key, redis::VectorAddInput::Values(redis::EmbeddingInput::Float64(vector)), element, &opts)
}

Implementations§

Source§

impl VAddOptions

Source

pub fn set_reduction_dimension(self, dimension: usize) -> Self

Set reduction dimension value

Source

pub fn set_check_and_set_style(self, cas_enabled: bool) -> Self

Set the CAS (check-and-set) style flag

Source

pub fn set_quantization(self, vector_quantization: VectorQuantization) -> Self

Set the quantization mode

Source

pub fn set_build_exploration_factor( self, build_exploration_factor: usize, ) -> Self

Set the build exploration factor

Source

pub fn set_attributes(self, attributes: Value) -> Self

Set attributes as JSON string

Set the maximum number of links

Trait Implementations§

Source§

impl Clone for VAddOptions

Source§

fn clone(&self) -> VAddOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for VAddOptions

Source§

fn default() -> VAddOptions

Returns the “default value” for a type. Read more
Source§

impl ToRedisArgs for VAddOptions

Source§

fn write_redis_args<W>(&self, out: &mut W)
where W: ?Sized + RedisWrite,

This writes the value into a vector of bytes. Each item is a single argument. Most items generate a single item. Read more
Source§

fn to_redis_args(&self) -> Vec<Vec<u8>>

This converts the value into a vector of bytes. Each item is a single argument. Most items generate a vector of a single item. Read more
Source§

fn describe_numeric_behavior(&self) -> NumericBehavior

Returns an information about the contained value with regards to it’s numeric behavior in a redis context. This is used in some high level concepts to switch between different implementations of redis functions (for instance INCR vs INCRBYFLOAT).
Source§

fn num_of_args(&self) -> usize

Returns the number of arguments this value will generate. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,