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
impl VAddOptions
Sourcepub fn set_reduction_dimension(self, dimension: usize) -> Self
pub fn set_reduction_dimension(self, dimension: usize) -> Self
Set reduction dimension value
Sourcepub fn set_check_and_set_style(self, cas_enabled: bool) -> Self
pub fn set_check_and_set_style(self, cas_enabled: bool) -> Self
Set the CAS (check-and-set) style flag
Sourcepub fn set_quantization(self, vector_quantization: VectorQuantization) -> Self
pub fn set_quantization(self, vector_quantization: VectorQuantization) -> Self
Set the quantization mode
Sourcepub fn set_build_exploration_factor(
self,
build_exploration_factor: usize,
) -> Self
pub fn set_build_exploration_factor( self, build_exploration_factor: usize, ) -> Self
Set the build exploration factor
Sourcepub fn set_attributes(self, attributes: Value) -> Self
pub fn set_attributes(self, attributes: Value) -> Self
Set attributes as JSON string
Sourcepub fn set_max_number_of_links(self, max_number_of_links: usize) -> Self
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
impl Clone for VAddOptions
Source§fn clone(&self) -> VAddOptions
fn clone(&self) -> VAddOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Default for VAddOptions
impl Default for VAddOptions
Source§fn default() -> VAddOptions
fn default() -> VAddOptions
Returns the “default value” for a type. Read more
Source§impl ToRedisArgs for VAddOptions
impl ToRedisArgs for VAddOptions
Source§fn write_redis_args<W>(&self, out: &mut W)where
W: ?Sized + RedisWrite,
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>>
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
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
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more