VAddOptions in redis::vector_sets - Rust
Description: Options for the VADD command

Skip to main content

## 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, vector_sets::*};
    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, VectorAddInput::Values(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

Source

#### pub fn set_max_number_of_links(self, max_number_of_links: usize) -> Self

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§

§

### impl Freeze for VAddOptions

§

### impl RefUnwindSafe for VAddOptions

§

### impl Send for VAddOptions

§

### impl Sync for VAddOptions

§

### impl Unpin for VAddOptions

§

### impl UnwindSafe for VAddOptions

## 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> DynClone for T
where T: Clone,

Source§

#### fn __clone_box(&self, _: Private) -> *mut ()

Source§

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

Source§

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

Returns the argument unchanged.

§

### impl<T> Instrument for T

§

#### fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [`Span`], returning an `Instrumented` wrapper. Read more
§

#### fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more
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.

§

### impl<T> PolicyExt for T
where T: ?Sized,

§

#### fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new `Policy` that returns [`Action::Follow`] only if `self` and `other` return `Action::Follow`. Read more
§

#### fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new `Policy` that returns [`Action::Follow`] if either `self` or `other` returns `Action::Follow`. Read more
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.
§

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

§

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

§

### impl<T> WithSubscriber for T

§

#### fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more
§

#### fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more
§

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

§

### impl<T> MaybeSendSync for T