pub trait ToValkeyArgs {
// Required method
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W);
// Provided methods
fn to_valkey_args(&self) -> Vec<Vec<u8>> { ... }
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior { ... }
fn num_of_args(&self) -> usize { ... }
}Expand description
Encodes a value into command arguments.
Implemented for the standard argument types:
- integers
- non-zero integers
- floats
- byte slices
- booleans
- strings
- bytes
- vectors
- slices
- arrays
- options
- references
- standard maps and sets
- tuples
Implement it for your own types to pass them directly as command arguments.
Mirrors redis-rs’s ToRedisArgs.
Required Methods§
Sourcefn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
Writes this value’s argument encoding to out.
Provided Methods§
Sourcefn to_valkey_args(&self) -> Vec<Vec<u8>>
fn to_valkey_args(&self) -> Vec<Vec<u8>>
Returns this value’s argument encoding as a vector.
Sourcefn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
The value’s numeric behavior.
Defaults to NonNumeric.
Sourcefn num_of_args(&self) -> usize
fn num_of_args(&self) -> usize
The number of command arguments this value encodes to.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl ToValkeyArgs for &str
Encodes a &str as a command argument.
impl ToValkeyArgs for &str
Encodes a &str as a command argument.
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
Source§impl ToValkeyArgs for NonZeroI8
impl ToValkeyArgs for NonZeroI8
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for NonZeroI16
impl ToValkeyArgs for NonZeroI16
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for NonZeroI32
impl ToValkeyArgs for NonZeroI32
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for NonZeroI64
impl ToValkeyArgs for NonZeroI64
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for NonZeroIsize
impl ToValkeyArgs for NonZeroIsize
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for NonZeroU8
impl ToValkeyArgs for NonZeroU8
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for NonZeroU16
impl ToValkeyArgs for NonZeroU16
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for NonZeroU32
impl ToValkeyArgs for NonZeroU32
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for NonZeroU64
impl ToValkeyArgs for NonZeroU64
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for NonZeroUsize
impl ToValkeyArgs for NonZeroUsize
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for String
Encodes a String as a command argument.
impl ToValkeyArgs for String
Encodes a String as a command argument.
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
Source§impl ToValkeyArgs for bool
Encodes a bool as a command argument.
impl ToValkeyArgs for bool
Encodes a bool as a command argument.
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
Source§impl ToValkeyArgs for f32
impl ToValkeyArgs for f32
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for f64
impl ToValkeyArgs for f64
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for i8
impl ToValkeyArgs for i8
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for i16
impl ToValkeyArgs for i16
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for i32
impl ToValkeyArgs for i32
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for i64
impl ToValkeyArgs for i64
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for isize
impl ToValkeyArgs for isize
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for u8
Encodes a u8 as a command argument.
impl ToValkeyArgs for u8
Encodes a u8 as a command argument.
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
Source§impl ToValkeyArgs for u16
impl ToValkeyArgs for u16
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for u32
impl ToValkeyArgs for u32
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for u64
impl ToValkeyArgs for u64
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl ToValkeyArgs for usize
impl ToValkeyArgs for usize
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
Source§impl<K, V: ToValkeyArgs, S: BuildHasher> ToValkeyArgs for HashMap<K, V, S>
Encodes a HashMap as command arguments.
Panics if a key or value does not encode as exactly one argument.
impl<K, V: ToValkeyArgs, S: BuildHasher> ToValkeyArgs for HashMap<K, V, S>
Encodes a HashMap as command arguments.
Panics if a key or value does not encode as exactly one argument.
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
Source§impl<K, V: ToValkeyArgs> ToValkeyArgs for BTreeMap<K, V>
Encodes a BTreeMap as command arguments.
Panics if a key or value does not encode as exactly one argument.
impl<K, V: ToValkeyArgs> ToValkeyArgs for BTreeMap<K, V>
Encodes a BTreeMap as command arguments.
Panics if a key or value does not encode as exactly one argument.
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
Source§impl<T: ToValkeyArgs + Eq + Hash + Ord> ToValkeyArgs for BTreeSet<T>
Encodes a BTreeSet’s members as command arguments.
impl<T: ToValkeyArgs + Eq + Hash + Ord> ToValkeyArgs for BTreeSet<T>
Encodes a BTreeSet’s members as command arguments.
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
Source§impl<T: ToValkeyArgs + Eq + Hash, S: BuildHasher> ToValkeyArgs for HashSet<T, S>
Encodes a HashSet’s members as command arguments.
impl<T: ToValkeyArgs + Eq + Hash, S: BuildHasher> ToValkeyArgs for HashSet<T, S>
Encodes a HashSet’s members as command arguments.
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
Source§impl<T: ToValkeyArgs, const N: usize> ToValkeyArgs for &[T; N]
Encodes a fixed-size array as command arguments.
impl<T: ToValkeyArgs, const N: usize> ToValkeyArgs for &[T; N]
Encodes a fixed-size array as command arguments.
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn num_of_args(&self) -> usize
Source§impl<T: ToValkeyArgs> ToValkeyArgs for &T
Encodes a reference as command arguments.
impl<T: ToValkeyArgs> ToValkeyArgs for &T
Encodes a reference as command arguments.
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
fn num_of_args(&self) -> usize
Source§impl<T: ToValkeyArgs> ToValkeyArgs for &[T]
Encodes a slice as command arguments.
impl<T: ToValkeyArgs> ToValkeyArgs for &[T]
Encodes a slice as command arguments.
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn num_of_args(&self) -> usize
Source§impl<T: ToValkeyArgs> ToValkeyArgs for Option<T>
Encodes an Option as command arguments.
impl<T: ToValkeyArgs> ToValkeyArgs for Option<T>
Encodes an Option as command arguments.
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn describe_numeric_behavior(&self) -> ValkeyNumericBehavior
fn num_of_args(&self) -> usize
Source§impl<T: ToValkeyArgs> ToValkeyArgs for Vec<T>
Encodes a Vec as command arguments.
impl<T: ToValkeyArgs> ToValkeyArgs for Vec<T>
Encodes a Vec as command arguments.
fn write_valkey_args<W: ?Sized + ValkeyWrite>(&self, out: &mut W)
fn num_of_args(&self) -> usize
Implementors§
impl ToValkeyArgs for BitEncoding
impl ToValkeyArgs for BitFieldOffset
impl ToValkeyArgs for BitFieldSubcommand
impl ToValkeyArgs for BitOverflow
impl ToValkeyArgs for Bytes
Encodes a Bytes as a command argument.