ManuallyDrop

Struct ManuallyDrop 

1.20.0 · Source
pub struct ManuallyDrop<T>
where T: ?Sized,
{ /* private fields */ }
Expand description

A wrapper to inhibit the compiler from automatically calling T’s destructor. This wrapper is 0-cost.

ManuallyDrop<T> is guaranteed to have the same layout and bit validity as T, and is subject to the same layout optimizations as T. As a consequence, it has no effect on the assumptions that the compiler makes about its contents. For example, initializing a ManuallyDrop<&mut T> with mem::zeroed is undefined behavior. If you need to handle uninitialized data, use MaybeUninit<T> instead.

Note that accessing the value inside a ManuallyDrop<T> is safe. This means that a ManuallyDrop<T> whose content has been dropped must not be exposed through a public safe API. Correspondingly, ManuallyDrop::drop is unsafe.

§ManuallyDrop and drop order

Rust has a well-defined drop order of values. To make sure that fields or locals are dropped in a specific order, reorder the declarations such that the implicit drop order is the correct one.

It is possible to use ManuallyDrop to control the drop order, but this requires unsafe code and is hard to do correctly in the presence of unwinding.

For example, if you want to make sure that a specific field is dropped after the others, make it the last field of a struct:

struct Context;

struct Widget {
    children: Vec<Widget>,
    // `context` will be dropped after `children`.
    // Rust guarantees that fields are dropped in the order of declaration.
    context: Context,
}

§Interaction with Box

Currently, if you have a ManuallyDrop<T>, where the type T is a Box or contains a Box inside, then dropping the T followed by moving the ManuallyDrop<T> is considered to be undefined behavior. That is, the following code causes undefined behavior:

use std::mem::ManuallyDrop;

let mut x = ManuallyDrop::new(Box::new(42));
unsafe {
    ManuallyDrop::drop(&mut x);
}
let y = x; // Undefined behavior!

This is likely to change in the future. In the meantime, consider using MaybeUninit instead.

§Safety hazards when storing ManuallyDrop in a struct or an enum.

Special care is needed when all of the conditions below are met:

  • A struct or enum contains a ManuallyDrop.
  • The ManuallyDrop is not inside a union.
  • The struct or enum is part of public API, or is stored in a struct or an enum that is part of public API.
  • There is code that drops the contents of the ManuallyDrop field, and this code is outside the struct or enum’s Drop implementation.

In particular, the following hazards may occur:

§Storing generic types

If the ManuallyDrop contains a client-supplied generic type, the client might provide a Box as that type. This would cause undefined behavior when the struct or enum is later moved, as mentioned in the previous section. For example, the following code causes undefined behavior:

use std::mem::ManuallyDrop;

pub struct BadOption<T> {
    // Invariant: Has been dropped if `is_some` is false.
    value: ManuallyDrop<T>,
    is_some: bool,
}
impl<T> BadOption<T> {
    pub fn new(value: T) -> Self {
        Self { value: ManuallyDrop::new(value), is_some: true }
    }
    pub fn change_to_none(&mut self) {
        if self.is_some {
            self.is_some = false;
            unsafe {
                // SAFETY: `value` hasn't been dropped yet, as per the invariant
                // (This is actually unsound!)
                ManuallyDrop::drop(&mut self.value);
            }
        }
    }
}

// In another crate:

let mut option = BadOption::new(Box::new(42));
option.change_to_none();
let option2 = option; // Undefined behavior!
§Deriving traits

Deriving Debug, Clone, PartialEq, PartialOrd, Ord, or Hash on the struct or enum could be unsound, since the derived implementations of these traits would access the ManuallyDrop field. For example, the following code causes undefined behavior:

use std::mem::ManuallyDrop;

// This derive is unsound in combination with the `ManuallyDrop::drop` call.
#[derive(Debug)]
pub struct Foo {
    value: ManuallyDrop<String>,
}
impl Foo {
    pub fn new() -> Self {
        let mut temp = Self {
            value: ManuallyDrop::new(String::from("Unsafe rust is hard."))
        };
        unsafe {
            // SAFETY: `value` hasn't been dropped yet.
            ManuallyDrop::drop(&mut temp.value);
        }
        temp
    }
}

// In another crate:

let foo = Foo::new();
println!("{:?}", foo); // Undefined behavior!

Implementations§

Source§

impl<T> ManuallyDrop<T>

1.20.0 (const: 1.32.0) · Source

pub const fn new(value: T) -> ManuallyDrop<T>

Wrap a value to be manually dropped.

§Examples
use std::mem::ManuallyDrop;
let mut x = ManuallyDrop::new(String::from("Hello World!"));
x.truncate(5); // You can still safely operate on the value
assert_eq!(*x, "Hello");
// But `Drop` will not be run here
1.20.0 (const: 1.32.0) · Source

pub const fn into_inner(slot: ManuallyDrop<T>) -> T

Extracts the value from the ManuallyDrop container.

This allows the value to be dropped again.

§Examples
use std::mem::ManuallyDrop;
let x = ManuallyDrop::new(Box::new(()));
let _: Box<()> = ManuallyDrop::into_inner(x); // This drops the `Box`.
1.42.0 (const: unstable) · Source

pub unsafe fn take(slot: &mut ManuallyDrop<T>) -> T

Takes the value from the ManuallyDrop<T> container out.

This method is primarily intended for moving out values in drop. Instead of using ManuallyDrop::drop to manually drop the value, you can use this method to take the value and use it however desired.

Whenever possible, it is preferable to use into_inner instead, which prevents duplicating the content of the ManuallyDrop<T>.

§Safety

This function semantically moves out the contained value without preventing further usage, leaving the state of this container unchanged. It is your responsibility to ensure that this ManuallyDrop is not used again.

Source§

impl<T> ManuallyDrop<T>
where T: ?Sized,

1.20.0 (const: unstable) · Source

pub unsafe fn drop(slot: &mut ManuallyDrop<T>)

Manually drops the contained value.

This is exactly equivalent to calling ptr::drop_in_place with a pointer to the contained value. As such, unless the contained value is a packed struct, the destructor will be called in-place without moving the value, and thus can be used to safely drop pinned data.

If you have ownership of the value, you can use ManuallyDrop::into_inner instead.

§Safety

This function runs the destructor of the contained value. Other than changes made by the destructor itself, the memory is left unchanged, and so as far as the compiler is concerned still holds a bit-pattern which is valid for the type T.

However, this “zombie” value should not be exposed to safe code, and this function should not be called more than once. To use a value after it’s been dropped, or drop a value multiple times, can cause Undefined Behavior (depending on what drop does). This is normally prevented by the type system, but users of ManuallyDrop must uphold those guarantees without assistance from the compiler.

Trait Implementations§

1.20.0 · Source§

impl<T> Clone for ManuallyDrop<T>
where T: Clone + ?Sized,

Source§

fn clone(&self) -> ManuallyDrop<T>

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
1.20.0 · Source§

impl<T> Debug for ManuallyDrop<T>
where T: Debug + ?Sized,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
1.20.0 · Source§

impl<T> Default for ManuallyDrop<T>
where T: Default + ?Sized,

Source§

fn default() -> ManuallyDrop<T>

Returns the “default value” for a type. Read more
1.20.0 (const: unstable) · Source§

impl<T> Deref for ManuallyDrop<T>
where T: ?Sized,

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
1.20.0 (const: unstable) · Source§

impl<T> DerefMut for ManuallyDrop<T>
where T: ?Sized,

Source§

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

Mutably dereferences the value.
Source§

impl<T> FromBytes for ManuallyDrop<T>
where T: FromBytes + ?Sized,

Source§

fn ref_from_bytes( source: &[u8], ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout + Immutable,

Interprets the given source as a &Self. Read more
Source§

fn ref_from_prefix( source: &[u8], ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout + Immutable,

Interprets the prefix of the given source as a &Self without copying. Read more
Source§

fn ref_from_suffix( source: &[u8], ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: Immutable + KnownLayout,

Interprets the suffix of the given bytes as a &Self. Read more
Source§

fn mut_from_bytes( source: &mut [u8], ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout,

Interprets the given source as a &mut Self. Read more
Source§

fn mut_from_prefix( source: &mut [u8], ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout,

Interprets the prefix of the given source as a &mut Self without copying. Read more
Source§

fn mut_from_suffix( source: &mut [u8], ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout,

Interprets the suffix of the given source as a &mut Self without copying. Read more
Source§

fn ref_from_bytes_with_elems( source: &[u8], count: usize, ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the given source as a &Self with a DST length equal to count. Read more
Source§

fn ref_from_prefix_with_elems( source: &[u8], count: usize, ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the prefix of the given source as a DST &Self with length equal to count. Read more
Source§

fn ref_from_suffix_with_elems( source: &[u8], count: usize, ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, Infallible>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the suffix of the given source as a DST &Self with length equal to count. Read more
Source§

fn mut_from_bytes_with_elems( source: &mut [u8], count: usize, ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the given source as a &mut Self with a DST length equal to count. Read more
Source§

fn mut_from_prefix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize>,

Interprets the prefix of the given source as a &mut Self with DST length equal to count. Read more
Source§

fn mut_from_suffix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, Infallible>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize>,

Interprets the suffix of the given source as a &mut Self with DST length equal to count. Read more
Source§

fn read_from_bytes(source: &[u8]) -> Result<Self, SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the given source. Read more
Source§

fn read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the prefix of the given source. Read more
Source§

fn read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the suffix of the given source. Read more
Source§

impl<T> FromZeros for ManuallyDrop<T>
where T: FromZeros + ?Sized,

Source§

fn zero(&mut self)

Overwrites self with zeros. Read more
Source§

fn new_zeroed() -> Self
where Self: Sized,

Creates an instance of Self from zeroed bytes. Read more
1.20.0 · Source§

impl<T> Hash for ManuallyDrop<T>
where T: Hash + ?Sized,

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> IntoBytes for ManuallyDrop<T>
where T: IntoBytes + ?Sized,

Source§

fn as_bytes(&self) -> &[u8]
where Self: Immutable,

Gets the bytes of this value. Read more
Source§

fn as_mut_bytes(&mut self) -> &mut [u8]
where Self: FromBytes,

Gets the bytes of this value mutably. Read more
Source§

fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to dst. Read more
Source§

fn write_to_prefix( &self, dst: &mut [u8], ) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to the prefix of dst. Read more
Source§

fn write_to_suffix( &self, dst: &mut [u8], ) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to the suffix of dst. Read more
Source§

impl<T> KnownLayout for ManuallyDrop<T>
where T: KnownLayout + ?Sized,

Source§

type PointerMetadata = <T as KnownLayout>::PointerMetadata

The type of metadata stored in a pointer to Self. Read more
1.20.0 · Source§

impl<T> Ord for ManuallyDrop<T>
where T: Ord + ?Sized,

Source§

fn cmp(&self, other: &ManuallyDrop<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
1.20.0 · Source§

impl<T> PartialEq for ManuallyDrop<T>
where T: PartialEq + ?Sized,

Source§

fn eq(&self, other: &ManuallyDrop<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
1.20.0 · Source§

impl<T> PartialOrd for ManuallyDrop<T>
where T: PartialOrd + ?Sized,

Source§

fn partial_cmp(&self, other: &ManuallyDrop<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T> TryFromBytes for ManuallyDrop<T>
where T: TryFromBytes + ?Sized,

Source§

fn try_ref_from_bytes( source: &[u8], ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the given source as a &Self. Read more
Source§

fn try_ref_from_prefix( source: &[u8], ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the prefix of the given source as a &Self. Read more
Source§

fn try_ref_from_suffix( source: &[u8], ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the suffix of the given source as a &Self. Read more
Source§

fn try_mut_from_bytes( bytes: &mut [u8], ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout + IntoBytes,

Attempts to interpret the given source as a &mut Self without copying. Read more
Source§

fn try_mut_from_prefix( source: &mut [u8], ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout + IntoBytes,

Attempts to interpret the prefix of the given source as a &mut Self. Read more
Source§

fn try_mut_from_suffix( source: &mut [u8], ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout + IntoBytes,

Attempts to interpret the suffix of the given source as a &mut Self. Read more
Source§

fn try_ref_from_bytes_with_elems( source: &[u8], count: usize, ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the given source as a &Self with a DST length equal to count. Read more
Source§

fn try_ref_from_prefix_with_elems( source: &[u8], count: usize, ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the prefix of the given source as a &Self with a DST length equal to count. Read more
Source§

fn try_ref_from_suffix_with_elems( source: &[u8], count: usize, ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the suffix of the given source as a &Self with a DST length equal to count. Read more
Source§

fn try_mut_from_bytes_with_elems( source: &mut [u8], count: usize, ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + IntoBytes,

Attempts to interpret the given source as a &mut Self with a DST length equal to count. Read more
Source§

fn try_mut_from_prefix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + IntoBytes,

Attempts to interpret the prefix of the given source as a &mut Self with a DST length equal to count. Read more
Source§

fn try_mut_from_suffix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + IntoBytes,

Attempts to interpret the suffix of the given source as a &mut Self with a DST length equal to count. Read more
Source§

fn try_read_from_bytes( source: &[u8], ) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read the given source as a Self. Read more
Source§

fn try_read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the prefix of the given source. Read more
Source§

fn try_read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the suffix of the given source. Read more
Source§

impl<T> CloneFromCell for ManuallyDrop<T>
where T: CloneFromCell,

1.20.0 · Source§

impl<T> Copy for ManuallyDrop<T>
where T: Copy + ?Sized,

Source§

impl<T> DerefPure for ManuallyDrop<T>
where T: ?Sized,

1.20.0 · Source§

impl<T> Eq for ManuallyDrop<T>
where T: Eq + ?Sized,

Source§

impl<T> Immutable for ManuallyDrop<T>
where T: Immutable + ?Sized,

1.20.0 · Source§

impl<T> StructuralPartialEq for ManuallyDrop<T>
where T: ?Sized,

Source§

impl<T> Unaligned for ManuallyDrop<T>
where T: Unaligned + ?Sized,

Auto Trait Implementations§

§

impl<T> Freeze for ManuallyDrop<T>
where T: Freeze + ?Sized,

§

impl<T> RefUnwindSafe for ManuallyDrop<T>
where T: RefUnwindSafe + ?Sized,

§

impl<T> Send for ManuallyDrop<T>
where T: Send + ?Sized,

§

impl<T> Sync for ManuallyDrop<T>
where T: Sync + ?Sized,

§

impl<T> Unpin for ManuallyDrop<T>
where T: Unpin + ?Sized,

§

impl<T> UnwindSafe for ManuallyDrop<T>
where T: UnwindSafe + ?Sized,

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> Chain<T> for T

Source§

fn len(&self) -> usize

The number of items that this chain link consists of.
Source§

fn append_to(self, v: &mut Vec<T>)

Append the elements in this link to the chain.
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> Commands for T
where T: ConnectionLike,

Source§

fn get<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Get the value of a key. If key is a vec this becomes an MGET.
Source§

fn mget<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Get values of keys
Source§

fn keys<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Gets all keys matching pattern
Source§

fn set<'a, K, V, RV>(&mut self, key: K, value: V) -> Result<RV, RedisError>

Set the string value of a key.
Source§

fn set_options<'a, K, V, RV>( &mut self, key: K, value: V, options: SetOptions, ) -> Result<RV, RedisError>

Set the string value of a key with options.
Source§

fn set_multiple<'a, K, V, RV>( &mut self, items: &'a [(K, V)], ) -> Result<RV, RedisError>

👎Deprecated since 0.22.4: Renamed to mset() to reflect Redis name
Sets multiple keys to their values.
Source§

fn mset<'a, K, V, RV>(&mut self, items: &'a [(K, V)]) -> Result<RV, RedisError>

Sets multiple keys to their values.
Source§

fn set_ex<'a, K, V, RV>( &mut self, key: K, value: V, seconds: u64, ) -> Result<RV, RedisError>

Set the value and expiration of a key.
Source§

fn pset_ex<'a, K, V, RV>( &mut self, key: K, value: V, milliseconds: u64, ) -> Result<RV, RedisError>

Set the value and expiration in milliseconds of a key.
Source§

fn set_nx<'a, K, V, RV>(&mut self, key: K, value: V) -> Result<RV, RedisError>

Set the value of a key, only if the key does not exist
Source§

fn mset_nx<'a, K, V, RV>( &mut self, items: &'a [(K, V)], ) -> Result<RV, RedisError>

Sets multiple keys to their values failing if at least one already exists.
Source§

fn getset<'a, K, V, RV>(&mut self, key: K, value: V) -> Result<RV, RedisError>

Set the string value of a key and return its old value.
Source§

fn getrange<'a, K, RV>( &mut self, key: K, from: isize, to: isize, ) -> Result<RV, RedisError>

Get a range of bytes/substring from the value of a key. Negative values provide an offset from the end of the value.
Source§

fn setrange<'a, K, V, RV>( &mut self, key: K, offset: isize, value: V, ) -> Result<RV, RedisError>

Overwrite the part of the value stored in key at the specified offset.
Source§

fn del<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Delete one or more keys.
Source§

fn exists<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Determine if a key exists.
Source§

fn key_type<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Determine the type of a key.
Source§

fn expire<'a, K, RV>(&mut self, key: K, seconds: i64) -> Result<RV, RedisError>

Set a key’s time to live in seconds.
Source§

fn expire_at<'a, K, RV>(&mut self, key: K, ts: i64) -> Result<RV, RedisError>

Set the expiration for a key as a UNIX timestamp.
Source§

fn pexpire<'a, K, RV>(&mut self, key: K, ms: i64) -> Result<RV, RedisError>

Set a key’s time to live in milliseconds.
Source§

fn pexpire_at<'a, K, RV>(&mut self, key: K, ts: i64) -> Result<RV, RedisError>

Set the expiration for a key as a UNIX timestamp in milliseconds.
Source§

fn expire_time<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Get the absolute Unix expiration timestamp in seconds.
Source§

fn pexpire_time<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Get the absolute Unix expiration timestamp in milliseconds.
Source§

fn persist<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Remove the expiration from a key.
Source§

fn ttl<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Get the time to live for a key in seconds.
Source§

fn pttl<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Get the time to live for a key in milliseconds.
Source§

fn get_ex<'a, K, RV>( &mut self, key: K, expire_at: Expiry, ) -> Result<RV, RedisError>

Get the value of a key and set expiration
Source§

fn get_del<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Get the value of a key and delete it
Source§

fn rename<'a, K, N, RV>(&mut self, key: K, new_key: N) -> Result<RV, RedisError>

Rename a key.
Source§

fn rename_nx<'a, K, N, RV>( &mut self, key: K, new_key: N, ) -> Result<RV, RedisError>

Rename a key, only if the new key does not exist.
Unlink one or more keys.
Source§

fn append<'a, K, V, RV>(&mut self, key: K, value: V) -> Result<RV, RedisError>

Append a value to a key.
Source§

fn incr<'a, K, V, RV>(&mut self, key: K, delta: V) -> Result<RV, RedisError>

Increment the numeric value of a key by the given amount. This issues a INCRBY or INCRBYFLOAT depending on the type.
Source§

fn decr<'a, K, V, RV>(&mut self, key: K, delta: V) -> Result<RV, RedisError>

Decrement the numeric value of a key by the given amount.
Source§

fn setbit<'a, K, RV>( &mut self, key: K, offset: usize, value: bool, ) -> Result<RV, RedisError>

Sets or clears the bit at offset in the string value stored at key.
Source§

fn getbit<'a, K, RV>(&mut self, key: K, offset: usize) -> Result<RV, RedisError>

Returns the bit value at offset in the string value stored at key.
Source§

fn bitcount<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Count set bits in a string.
Source§

fn bitcount_range<'a, K, RV>( &mut self, key: K, start: usize, end: usize, ) -> Result<RV, RedisError>

Count set bits in a string in a range.
Source§

fn bit_and<'a, D, S, RV>( &mut self, dstkey: D, srckeys: S, ) -> Result<RV, RedisError>

Perform a bitwise AND between multiple keys (containing string values) and store the result in the destination key.
Source§

fn bit_or<'a, D, S, RV>( &mut self, dstkey: D, srckeys: S, ) -> Result<RV, RedisError>

Perform a bitwise OR between multiple keys (containing string values) and store the result in the destination key.
Source§

fn bit_xor<'a, D, S, RV>( &mut self, dstkey: D, srckeys: S, ) -> Result<RV, RedisError>

Perform a bitwise XOR between multiple keys (containing string values) and store the result in the destination key.
Source§

fn bit_not<'a, D, S, RV>( &mut self, dstkey: D, srckey: S, ) -> Result<RV, RedisError>

Perform a bitwise NOT of the key (containing string values) and store the result in the destination key.
Source§

fn strlen<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Get the length of the value stored in a key.
Source§

fn hget<'a, K, F, RV>(&mut self, key: K, field: F) -> Result<RV, RedisError>

Gets a single (or multiple) fields from a hash.
Source§

fn hget_ex<'a, K, F, RV>( &mut self, key: K, fields: F, expire_at: Expiry, ) -> Result<RV, RedisError>

Get the value of one or more fields of a given hash key, and optionally set their expiration
Source§

fn hdel<'a, K, F, RV>(&mut self, key: K, field: F) -> Result<RV, RedisError>

Deletes a single (or multiple) fields from a hash.
Source§

fn hget_del<'a, K, F, RV>( &mut self, key: K, fields: F, ) -> Result<RV, RedisError>

Get and delete the value of one or more fields of a given hash key
Source§

fn hset<'a, K, F, V, RV>( &mut self, key: K, field: F, value: V, ) -> Result<RV, RedisError>

Sets a single field in a hash.
Source§

fn hset_ex<'a, K, F, V, RV>( &mut self, key: K, hash_field_expiration_options: &'a HashFieldExpirationOptions, fields_values: &'a [(F, V)], ) -> Result<RV, RedisError>

Set the value of one or more fields of a given hash key, and optionally set their expiration
Source§

fn hset_nx<'a, K, F, V, RV>( &mut self, key: K, field: F, value: V, ) -> Result<RV, RedisError>

Sets a single field in a hash if it does not exist.
Source§

fn hset_multiple<'a, K, F, V, RV>( &mut self, key: K, items: &'a [(F, V)], ) -> Result<RV, RedisError>

Sets multiple fields in a hash.
Source§

fn hincr<'a, K, F, D, RV>( &mut self, key: K, field: F, delta: D, ) -> Result<RV, RedisError>

Increments a value.
Source§

fn hexists<'a, K, F, RV>(&mut self, key: K, field: F) -> Result<RV, RedisError>

Checks if a field in a hash exists.
Source§

fn httl<'a, K, F, RV>(&mut self, key: K, fields: F) -> Result<RV, RedisError>

Get one or more fields’ TTL in seconds.
Source§

fn hpttl<'a, K, F, RV>(&mut self, key: K, fields: F) -> Result<RV, RedisError>

Get one or more fields’ TTL in milliseconds.
Source§

fn hexpire<'a, K, F, RV>( &mut self, key: K, seconds: i64, opt: ExpireOption, fields: F, ) -> Result<RV, RedisError>

Set one or more fields’ time to live in seconds.
Source§

fn hexpire_at<'a, K, F, RV>( &mut self, key: K, ts: i64, opt: ExpireOption, fields: F, ) -> Result<RV, RedisError>

Set the expiration for one or more fields as a UNIX timestamp in milliseconds.
Source§

fn hexpire_time<'a, K, F, RV>( &mut self, key: K, fields: F, ) -> Result<RV, RedisError>

Returns the absolute Unix expiration timestamp in seconds.
Source§

fn hpersist<'a, K, F, RV>( &mut self, key: K, fields: F, ) -> Result<RV, RedisError>

Remove the expiration from a key.
Source§

fn hpexpire<'a, K, F, RV>( &mut self, key: K, milliseconds: i64, opt: ExpireOption, fields: F, ) -> Result<RV, RedisError>

Set one or more fields’ time to live in milliseconds.
Source§

fn hpexpire_at<'a, K, F, RV>( &mut self, key: K, ts: i64, opt: ExpireOption, fields: F, ) -> Result<RV, RedisError>

Set the expiration for one or more fields as a UNIX timestamp in milliseconds.
Source§

fn hpexpire_time<'a, K, F, RV>( &mut self, key: K, fields: F, ) -> Result<RV, RedisError>

Returns the absolute Unix expiration timestamp in seconds.
Source§

fn hkeys<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Gets all the keys in a hash.
Source§

fn hvals<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Gets all the values in a hash.
Source§

fn hgetall<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Gets all the fields and values in a hash.
Source§

fn hlen<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Gets the length of a hash.
Source§

fn blmove<'a, S, D, RV>( &mut self, srckey: S, dstkey: D, src_dir: Direction, dst_dir: Direction, timeout: f64, ) -> Result<RV, RedisError>

Pop an element from a list, push it to another list and return it; or block until one is available
Source§

fn blmpop<'a, K, RV>( &mut self, timeout: f64, numkeys: usize, key: K, dir: Direction, count: usize, ) -> Result<RV, RedisError>

Pops count elements from the first non-empty list key from the list of provided key names; or blocks until one is available.
Source§

fn blpop<'a, K, RV>(&mut self, key: K, timeout: f64) -> Result<RV, RedisError>

Remove and get the first element in a list, or block until one is available.
Source§

fn brpop<'a, K, RV>(&mut self, key: K, timeout: f64) -> Result<RV, RedisError>

Remove and get the last element in a list, or block until one is available.
Source§

fn brpoplpush<'a, S, D, RV>( &mut self, srckey: S, dstkey: D, timeout: f64, ) -> Result<RV, RedisError>

Pop a value from a list, push it to another list and return it; or block until one is available.
Source§

fn lindex<'a, K, RV>(&mut self, key: K, index: isize) -> Result<RV, RedisError>

Get an element from a list by its index.
Source§

fn linsert_before<'a, K, P, V, RV>( &mut self, key: K, pivot: P, value: V, ) -> Result<RV, RedisError>

Insert an element before another element in a list.
Source§

fn linsert_after<'a, K, P, V, RV>( &mut self, key: K, pivot: P, value: V, ) -> Result<RV, RedisError>

Insert an element after another element in a list.
Source§

fn llen<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Returns the length of the list stored at key.
Source§

fn lmove<'a, S, D, RV>( &mut self, srckey: S, dstkey: D, src_dir: Direction, dst_dir: Direction, ) -> Result<RV, RedisError>

Pop an element a list, push it to another list and return it
Source§

fn lmpop<'a, K, RV>( &mut self, numkeys: usize, key: K, dir: Direction, count: usize, ) -> Result<RV, RedisError>

Pops count elements from the first non-empty list key from the list of provided key names.
Source§

fn lpop<'a, K, RV>( &mut self, key: K, count: Option<NonZero<usize>>, ) -> Result<RV, RedisError>

Removes and returns the up to count first elements of the list stored at key. Read more
Source§

fn lpos<'a, K, V, RV>( &mut self, key: K, value: V, options: LposOptions, ) -> Result<RV, RedisError>

Returns the index of the first matching value of the list stored at key.
Source§

fn lpush<'a, K, V, RV>(&mut self, key: K, value: V) -> Result<RV, RedisError>

Insert all the specified values at the head of the list stored at key.
Source§

fn lpush_exists<'a, K, V, RV>( &mut self, key: K, value: V, ) -> Result<RV, RedisError>

Inserts a value at the head of the list stored at key, only if key already exists and holds a list.
Source§

fn lrange<'a, K, RV>( &mut self, key: K, start: isize, stop: isize, ) -> Result<RV, RedisError>

Returns the specified elements of the list stored at key.
Source§

fn lrem<'a, K, V, RV>( &mut self, key: K, count: isize, value: V, ) -> Result<RV, RedisError>

Removes the first count occurrences of elements equal to value from the list stored at key.
Source§

fn ltrim<'a, K, RV>( &mut self, key: K, start: isize, stop: isize, ) -> Result<RV, RedisError>

Trim an existing list so that it will contain only the specified range of elements specified.
Source§

fn lset<'a, K, V, RV>( &mut self, key: K, index: isize, value: V, ) -> Result<RV, RedisError>

Sets the list element at index to value
Source§

fn ping<'a, RV>(&mut self) -> Result<RV, RedisError>
where RV: FromRedisValue,

Sends a ping to the server
Source§

fn ping_message<'a, K, RV>(&mut self, message: K) -> Result<RV, RedisError>

Sends a ping with a message to the server
Source§

fn rpop<'a, K, RV>( &mut self, key: K, count: Option<NonZero<usize>>, ) -> Result<RV, RedisError>

Removes and returns the up to count last elements of the list stored at key Read more
Source§

fn rpoplpush<'a, K, D, RV>( &mut self, key: K, dstkey: D, ) -> Result<RV, RedisError>

Pop a value from a list, push it to another list and return it.
Source§

fn rpush<'a, K, V, RV>(&mut self, key: K, value: V) -> Result<RV, RedisError>

Insert all the specified values at the tail of the list stored at key.
Source§

fn rpush_exists<'a, K, V, RV>( &mut self, key: K, value: V, ) -> Result<RV, RedisError>

Inserts value at the tail of the list stored at key, only if key already exists and holds a list.
Source§

fn sadd<'a, K, M, RV>(&mut self, key: K, member: M) -> Result<RV, RedisError>

Add one or more members to a set.
Source§

fn scard<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Get the number of members in a set.
Source§

fn sdiff<'a, K, RV>(&mut self, keys: K) -> Result<RV, RedisError>

Subtract multiple sets.
Source§

fn sdiffstore<'a, D, K, RV>( &mut self, dstkey: D, keys: K, ) -> Result<RV, RedisError>

Subtract multiple sets and store the resulting set in a key.
Source§

fn sinter<'a, K, RV>(&mut self, keys: K) -> Result<RV, RedisError>

Intersect multiple sets.
Source§

fn sinterstore<'a, D, K, RV>( &mut self, dstkey: D, keys: K, ) -> Result<RV, RedisError>

Intersect multiple sets and store the resulting set in a key.
Source§

fn sismember<'a, K, M, RV>( &mut self, key: K, member: M, ) -> Result<RV, RedisError>

Determine if a given value is a member of a set.
Source§

fn smismember<'a, K, M, RV>( &mut self, key: K, members: M, ) -> Result<RV, RedisError>

Determine if given values are members of a set.
Source§

fn smembers<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Get all the members in a set.
Source§

fn smove<'a, S, D, M, RV>( &mut self, srckey: S, dstkey: D, member: M, ) -> Result<RV, RedisError>

Move a member from one set to another.
Source§

fn spop<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Remove and return a random member from a set.
Source§

fn srandmember<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Get one random member from a set.
Source§

fn srandmember_multiple<'a, K, RV>( &mut self, key: K, count: usize, ) -> Result<RV, RedisError>

Get multiple random members from a set.
Source§

fn srem<'a, K, M, RV>(&mut self, key: K, member: M) -> Result<RV, RedisError>

Remove one or more members from a set.
Source§

fn sunion<'a, K, RV>(&mut self, keys: K) -> Result<RV, RedisError>

Add multiple sets.
Source§

fn sunionstore<'a, D, K, RV>( &mut self, dstkey: D, keys: K, ) -> Result<RV, RedisError>

Add multiple sets and store the resulting set in a key.
Source§

fn zadd<'a, K, S, M, RV>( &mut self, key: K, member: M, score: S, ) -> Result<RV, RedisError>

Add one member to a sorted set, or update its score if it already exists.
Source§

fn zadd_multiple<'a, K, S, M, RV>( &mut self, key: K, items: &'a [(S, M)], ) -> Result<RV, RedisError>

Add multiple members to a sorted set, or update its score if it already exists.
Source§

fn zcard<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Get the number of members in a sorted set.
Source§

fn zcount<'a, K, M, MM, RV>( &mut self, key: K, min: M, max: MM, ) -> Result<RV, RedisError>

Count the members in a sorted set with scores within the given values.
Source§

fn zincr<'a, K, M, D, RV>( &mut self, key: K, member: M, delta: D, ) -> Result<RV, RedisError>

Increments the member in a sorted set at key by delta. If the member does not exist, it is added with delta as its score.
Source§

fn zinterstore<'a, D, K, RV>( &mut self, dstkey: D, keys: K, ) -> Result<RV, RedisError>

Intersect multiple sorted sets and store the resulting sorted set in a new key using SUM as aggregation function.
Source§

fn zinterstore_min<'a, D, K, RV>( &mut self, dstkey: D, keys: K, ) -> Result<RV, RedisError>

Intersect multiple sorted sets and store the resulting sorted set in a new key using MIN as aggregation function.
Source§

fn zinterstore_max<'a, D, K, RV>( &mut self, dstkey: D, keys: K, ) -> Result<RV, RedisError>

Intersect multiple sorted sets and store the resulting sorted set in a new key using MAX as aggregation function.
Source§

fn zinterstore_weights<'a, D, K, W, RV>( &mut self, dstkey: D, keys: &'a [(K, W)], ) -> Result<RV, RedisError>

Commands::zinterstore, but with the ability to specify a multiplication factor for each sorted set by pairing one with each key in a tuple.
Source§

fn zinterstore_min_weights<'a, D, K, W, RV>( &mut self, dstkey: D, keys: &'a [(K, W)], ) -> Result<RV, RedisError>

Commands::zinterstore_min, but with the ability to specify a multiplication factor for each sorted set by pairing one with each key in a tuple.
Source§

fn zinterstore_max_weights<'a, D, K, W, RV>( &mut self, dstkey: D, keys: &'a [(K, W)], ) -> Result<RV, RedisError>

Commands::zinterstore_max, but with the ability to specify a multiplication factor for each sorted set by pairing one with each key in a tuple.
Source§

fn zlexcount<'a, K, M, MM, RV>( &mut self, key: K, min: M, max: MM, ) -> Result<RV, RedisError>

Count the number of members in a sorted set between a given lexicographical range.
Source§

fn bzpopmax<'a, K, RV>( &mut self, key: K, timeout: f64, ) -> Result<RV, RedisError>

Removes and returns the member with the highest score in a sorted set. Blocks until a member is available otherwise.
Source§

fn zpopmax<'a, K, RV>(&mut self, key: K, count: isize) -> Result<RV, RedisError>

Removes and returns up to count members with the highest scores in a sorted set
Source§

fn bzpopmin<'a, K, RV>( &mut self, key: K, timeout: f64, ) -> Result<RV, RedisError>

Removes and returns the member with the lowest score in a sorted set. Blocks until a member is available otherwise.
Source§

fn zpopmin<'a, K, RV>(&mut self, key: K, count: isize) -> Result<RV, RedisError>

Removes and returns up to count members with the lowest scores in a sorted set
Source§

fn bzmpop_max<'a, K, RV>( &mut self, timeout: f64, keys: K, count: isize, ) -> Result<RV, RedisError>

Removes and returns up to count members with the highest scores, from the first non-empty sorted set in the provided list of key names. Blocks until a member is available otherwise.
Source§

fn zmpop_max<'a, K, RV>( &mut self, keys: K, count: isize, ) -> Result<RV, RedisError>

Removes and returns up to count members with the highest scores, from the first non-empty sorted set in the provided list of key names.
Source§

fn bzmpop_min<'a, K, RV>( &mut self, timeout: f64, keys: K, count: isize, ) -> Result<RV, RedisError>

Removes and returns up to count members with the lowest scores, from the first non-empty sorted set in the provided list of key names. Blocks until a member is available otherwise.
Source§

fn zmpop_min<'a, K, RV>( &mut self, keys: K, count: isize, ) -> Result<RV, RedisError>

Removes and returns up to count members with the lowest scores, from the first non-empty sorted set in the provided list of key names.
Source§

fn zrandmember<'a, K, RV>( &mut self, key: K, count: Option<isize>, ) -> Result<RV, RedisError>

Return up to count random members in a sorted set (or 1 if count == None)
Source§

fn zrandmember_withscores<'a, K, RV>( &mut self, key: K, count: isize, ) -> Result<RV, RedisError>

Return up to count random members in a sorted set with scores
Source§

fn zrange<'a, K, RV>( &mut self, key: K, start: isize, stop: isize, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by index
Source§

fn zrange_withscores<'a, K, RV>( &mut self, key: K, start: isize, stop: isize, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by index with scores.
Source§

fn zrangebylex<'a, K, M, MM, RV>( &mut self, key: K, min: M, max: MM, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by lexicographical range.
Source§

fn zrangebylex_limit<'a, K, M, MM, RV>( &mut self, key: K, min: M, max: MM, offset: isize, count: isize, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by lexicographical range with offset and limit.
Source§

fn zrevrangebylex<'a, K, MM, M, RV>( &mut self, key: K, max: MM, min: M, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by lexicographical range.
Source§

fn zrevrangebylex_limit<'a, K, MM, M, RV>( &mut self, key: K, max: MM, min: M, offset: isize, count: isize, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by lexicographical range with offset and limit.
Source§

fn zrangebyscore<'a, K, M, MM, RV>( &mut self, key: K, min: M, max: MM, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by score.
Source§

fn zrangebyscore_withscores<'a, K, M, MM, RV>( &mut self, key: K, min: M, max: MM, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by score with scores.
Source§

fn zrangebyscore_limit<'a, K, M, MM, RV>( &mut self, key: K, min: M, max: MM, offset: isize, count: isize, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by score with limit.
Source§

fn zrangebyscore_limit_withscores<'a, K, M, MM, RV>( &mut self, key: K, min: M, max: MM, offset: isize, count: isize, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by score with limit with scores.
Source§

fn zrank<'a, K, M, RV>(&mut self, key: K, member: M) -> Result<RV, RedisError>

Determine the index of a member in a sorted set.
Source§

fn zrem<'a, K, M, RV>(&mut self, key: K, members: M) -> Result<RV, RedisError>

Remove one or more members from a sorted set.
Source§

fn zrembylex<'a, K, M, MM, RV>( &mut self, key: K, min: M, max: MM, ) -> Result<RV, RedisError>

Remove all members in a sorted set between the given lexicographical range.
Source§

fn zremrangebyrank<'a, K, RV>( &mut self, key: K, start: isize, stop: isize, ) -> Result<RV, RedisError>

Remove all members in a sorted set within the given indexes.
Source§

fn zrembyscore<'a, K, M, MM, RV>( &mut self, key: K, min: M, max: MM, ) -> Result<RV, RedisError>

Remove all members in a sorted set within the given scores.
Source§

fn zrevrange<'a, K, RV>( &mut self, key: K, start: isize, stop: isize, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by index, with scores ordered from high to low.
Source§

fn zrevrange_withscores<'a, K, RV>( &mut self, key: K, start: isize, stop: isize, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by index, with scores ordered from high to low.
Source§

fn zrevrangebyscore<'a, K, MM, M, RV>( &mut self, key: K, max: MM, min: M, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by score.
Source§

fn zrevrangebyscore_withscores<'a, K, MM, M, RV>( &mut self, key: K, max: MM, min: M, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by score with scores.
Source§

fn zrevrangebyscore_limit<'a, K, MM, M, RV>( &mut self, key: K, max: MM, min: M, offset: isize, count: isize, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by score with limit.
Source§

fn zrevrangebyscore_limit_withscores<'a, K, MM, M, RV>( &mut self, key: K, max: MM, min: M, offset: isize, count: isize, ) -> Result<RV, RedisError>

Return a range of members in a sorted set, by score with limit with scores.
Source§

fn zrevrank<'a, K, M, RV>( &mut self, key: K, member: M, ) -> Result<RV, RedisError>

Determine the index of a member in a sorted set, with scores ordered from high to low.
Source§

fn zscore<'a, K, M, RV>(&mut self, key: K, member: M) -> Result<RV, RedisError>

Get the score associated with the given member in a sorted set.
Source§

fn zscore_multiple<'a, K, M, RV>( &mut self, key: K, members: &'a [M], ) -> Result<RV, RedisError>

Get the scores associated with multiple members in a sorted set.
Source§

fn zunionstore<'a, D, K, RV>( &mut self, dstkey: D, keys: K, ) -> Result<RV, RedisError>

Unions multiple sorted sets and store the resulting sorted set in a new key using SUM as aggregation function.
Source§

fn zunionstore_min<'a, D, K, RV>( &mut self, dstkey: D, keys: K, ) -> Result<RV, RedisError>

Unions multiple sorted sets and store the resulting sorted set in a new key using MIN as aggregation function.
Source§

fn zunionstore_max<'a, D, K, RV>( &mut self, dstkey: D, keys: K, ) -> Result<RV, RedisError>

Unions multiple sorted sets and store the resulting sorted set in a new key using MAX as aggregation function.
Source§

fn zunionstore_weights<'a, D, K, W, RV>( &mut self, dstkey: D, keys: &'a [(K, W)], ) -> Result<RV, RedisError>

Commands::zunionstore, but with the ability to specify a multiplication factor for each sorted set by pairing one with each key in a tuple.
Source§

fn zunionstore_min_weights<'a, D, K, W, RV>( &mut self, dstkey: D, keys: &'a [(K, W)], ) -> Result<RV, RedisError>

Commands::zunionstore_min, but with the ability to specify a multiplication factor for each sorted set by pairing one with each key in a tuple.
Source§

fn zunionstore_max_weights<'a, D, K, W, RV>( &mut self, dstkey: D, keys: &'a [(K, W)], ) -> Result<RV, RedisError>

Commands::zunionstore_max, but with the ability to specify a multiplication factor for each sorted set by pairing one with each key in a tuple.
Source§

fn pfadd<'a, K, E, RV>(&mut self, key: K, element: E) -> Result<RV, RedisError>

Adds the specified elements to the specified HyperLogLog.
Source§

fn pfcount<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).
Source§

fn pfmerge<'a, D, S, RV>( &mut self, dstkey: D, srckeys: S, ) -> Result<RV, RedisError>

Merge N different HyperLogLogs into a single one.
Source§

fn publish<'a, K, E, RV>( &mut self, channel: K, message: E, ) -> Result<RV, RedisError>

Posts a message to the given channel.
Source§

fn spublish<'a, K, E, RV>( &mut self, channel: K, message: E, ) -> Result<RV, RedisError>

Posts a message to the given sharded channel.
Source§

fn object_encoding<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Returns the encoding of a key.
Source§

fn object_idletime<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Returns the time in seconds since the last access of a key.
Source§

fn object_freq<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Returns the logarithmic access frequency counter of a key.
Source§

fn object_refcount<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Returns the reference count of a key.
Source§

fn client_getname<'a, RV>(&mut self) -> Result<RV, RedisError>
where RV: FromRedisValue,

Returns the name of the current connection as set by CLIENT SETNAME.
Source§

fn client_id<'a, RV>(&mut self) -> Result<RV, RedisError>
where RV: FromRedisValue,

Returns the ID of the current connection.
Source§

fn client_setname<'a, K, RV>( &mut self, connection_name: K, ) -> Result<RV, RedisError>

Command assigns a name to the current connection.
Source§

fn acl_load<'a, RV>(&mut self) -> Result<RV, RedisError>
where RV: FromRedisValue,

When Redis is configured to use an ACL file (with the aclfile configuration option), this command will reload the ACLs from the file, replacing all the current ACL rules with the ones defined in the file.
Source§

fn acl_save<'a, RV>(&mut self) -> Result<RV, RedisError>
where RV: FromRedisValue,

When Redis is configured to use an ACL file (with the aclfile configuration option), this command will save the currently defined ACLs from the server memory to the ACL file.
Source§

fn acl_list<'a, RV>(&mut self) -> Result<RV, RedisError>
where RV: FromRedisValue,

Shows the currently active ACL rules in the Redis server.
Source§

fn acl_users<'a, RV>(&mut self) -> Result<RV, RedisError>
where RV: FromRedisValue,

Shows a list of all the usernames of the currently configured users in the Redis ACL system.
Source§

fn acl_getuser<'a, K, RV>(&mut self, username: K) -> Result<RV, RedisError>

Returns all the rules defined for an existing ACL user.
Source§

fn acl_setuser<'a, K, RV>(&mut self, username: K) -> Result<RV, RedisError>

Creates an ACL user without any privilege.
Source§

fn acl_setuser_rules<'a, K, RV>( &mut self, username: K, rules: &'a [Rule], ) -> Result<RV, RedisError>

Creates an ACL user with the specified rules or modify the rules of an existing user.
Source§

fn acl_deluser<'a, K, RV>( &mut self, usernames: &'a [K], ) -> Result<RV, RedisError>

Delete all the specified ACL users and terminate all the connections that are authenticated with such users.
Source§

fn acl_dryrun<'a, K, C, A, RV>( &mut self, username: K, command: C, args: A, ) -> Result<RV, RedisError>

Simulate the execution of a given command by a given user.
Source§

fn acl_cat<'a, RV>(&mut self) -> Result<RV, RedisError>
where RV: FromRedisValue,

Shows the available ACL categories.
Source§

fn acl_cat_categoryname<'a, K, RV>( &mut self, categoryname: K, ) -> Result<RV, RedisError>

Shows all the Redis commands in the specified category.
Source§

fn acl_genpass<'a, RV>(&mut self) -> Result<RV, RedisError>
where RV: FromRedisValue,

Generates a 256-bits password starting from /dev/urandom if available.
Source§

fn acl_genpass_bits<'a, RV>(&mut self, bits: isize) -> Result<RV, RedisError>
where RV: FromRedisValue,

Generates a 1-to-1024-bits password starting from /dev/urandom if available.
Source§

fn acl_whoami<'a, RV>(&mut self) -> Result<RV, RedisError>
where RV: FromRedisValue,

Returns the username the current connection is authenticated with.
Source§

fn acl_log<'a, RV>(&mut self, count: isize) -> Result<RV, RedisError>
where RV: FromRedisValue,

Shows a list of recent ACL security events
Source§

fn acl_log_reset<'a, RV>(&mut self) -> Result<RV, RedisError>
where RV: FromRedisValue,

Clears the ACL log.
Source§

fn acl_help<'a, RV>(&mut self) -> Result<RV, RedisError>
where RV: FromRedisValue,

Returns a helpful text describing the different subcommands.
Source§

fn geo_add<'a, K, M, RV>( &mut self, key: K, members: M, ) -> Result<RV, RedisError>

Adds the specified geospatial items to the specified key. Read more
Source§

fn geo_dist<'a, K, M1, M2, RV>( &mut self, key: K, member1: M1, member2: M2, unit: Unit, ) -> Result<RV, RedisError>

Return the distance between two members in the geospatial index represented by the sorted set. Read more
Source§

fn geo_hash<'a, K, M, RV>( &mut self, key: K, members: M, ) -> Result<RV, RedisError>

Return valid Geohash strings representing the position of one or more members of the geospatial index represented by the sorted set at key. Read more
Source§

fn geo_pos<'a, K, M, RV>( &mut self, key: K, members: M, ) -> Result<RV, RedisError>

Return the positions of all the specified members of the geospatial index represented by the sorted set at key. Read more
Source§

fn geo_radius<'a, K, RV>( &mut self, key: K, longitude: f64, latitude: f64, radius: f64, unit: Unit, options: RadiusOptions, ) -> Result<RV, RedisError>

Return the members of a sorted set populated with geospatial information using geo_add, which are within the borders of the area specified with the center location and the maximum distance from the center (the radius). Read more
Source§

fn geo_radius_by_member<'a, K, M, RV>( &mut self, key: K, member: M, radius: f64, unit: Unit, options: RadiusOptions, ) -> Result<RV, RedisError>

Retrieve members selected by distance with the center of member. The member itself is always contained in the results.
Source§

fn xack<'a, K, G, I, RV>( &mut self, key: K, group: G, ids: &'a [I], ) -> Result<RV, RedisError>

Ack pending stream messages checked out by a consumer. Read more
Source§

fn xadd<'a, K, ID, F, V, RV>( &mut self, key: K, id: ID, items: &'a [(F, V)], ) -> Result<RV, RedisError>

Add a stream message by key. Use * as the id for the current timestamp. Read more
Source§

fn xadd_map<'a, K, ID, BTM, RV>( &mut self, key: K, id: ID, map: BTM, ) -> Result<RV, RedisError>

BTreeMap variant for adding a stream message by key. Use * as the id for the current timestamp. Read more
Source§

fn xadd_options<'a, K, ID, I, RV>( &mut self, key: K, id: ID, items: I, options: &'a StreamAddOptions, ) -> Result<RV, RedisError>

Add a stream message with options. Read more
Source§

fn xadd_maxlen<'a, K, ID, F, V, RV>( &mut self, key: K, maxlen: StreamMaxlen, id: ID, items: &'a [(F, V)], ) -> Result<RV, RedisError>

Add a stream message while capping the stream at a maxlength. Read more
Source§

fn xadd_maxlen_map<'a, K, ID, BTM, RV>( &mut self, key: K, maxlen: StreamMaxlen, id: ID, map: BTM, ) -> Result<RV, RedisError>

BTreeMap variant for adding a stream message while capping the stream at a maxlength. Read more
Source§

fn xautoclaim_options<'a, K, G, C, MIT, S, RV>( &mut self, key: K, group: G, consumer: C, min_idle_time: MIT, start: S, options: StreamAutoClaimOptions, ) -> Result<RV, RedisError>

Perform a combined xpending and xclaim flow. Read more
Source§

fn xclaim<'a, K, G, C, MIT, ID, RV>( &mut self, key: K, group: G, consumer: C, min_idle_time: MIT, ids: &'a [ID], ) -> Result<RV, RedisError>

Claim pending, unacked messages, after some period of time, currently checked out by another consumer. Read more
Source§

fn xclaim_options<'a, K, G, C, MIT, ID, RV>( &mut self, key: K, group: G, consumer: C, min_idle_time: MIT, ids: &'a [ID], options: StreamClaimOptions, ) -> Result<RV, RedisError>

This is the optional arguments version for claiming unacked, pending messages currently checked out by another consumer. Read more
Source§

fn xdel<'a, K, ID, RV>( &mut self, key: K, ids: &'a [ID], ) -> Result<RV, RedisError>

Deletes a list of ids for a given stream key. Read more
Source§

fn xgroup_create<'a, K, G, ID, RV>( &mut self, key: K, group: G, id: ID, ) -> Result<RV, RedisError>

This command is used for creating a consumer group. It expects the stream key to already exist. Otherwise, use xgroup_create_mkstream if it doesn’t. The id is the starting message id all consumers should read from. Use $ If you want all consumers to read from the last message added to stream. Read more
Source§

fn xgroup_createconsumer<'a, K, G, C, RV>( &mut self, key: K, group: G, consumer: C, ) -> Result<RV, RedisError>

This creates a consumer explicitly (vs implicit via XREADGROUP) for given stream `key. Read more
Source§

fn xgroup_create_mkstream<'a, K, G, ID, RV>( &mut self, key: K, group: G, id: ID, ) -> Result<RV, RedisError>

This is the alternate version for creating a consumer group which makes the stream if it doesn’t exist. Read more
Source§

fn xgroup_setid<'a, K, G, ID, RV>( &mut self, key: K, group: G, id: ID, ) -> Result<RV, RedisError>

Alter which id you want consumers to begin reading from an existing consumer group. Read more
Source§

fn xgroup_destroy<'a, K, G, RV>( &mut self, key: K, group: G, ) -> Result<RV, RedisError>

Destroy an existing consumer group for a given stream key Read more
Source§

fn xgroup_delconsumer<'a, K, G, C, RV>( &mut self, key: K, group: G, consumer: C, ) -> Result<RV, RedisError>

This deletes a consumer from an existing consumer group for given stream `key. Read more
Source§

fn xinfo_consumers<'a, K, G, RV>( &mut self, key: K, group: G, ) -> Result<RV, RedisError>

This returns all info details about which consumers have read messages for given consumer group. Take note of the StreamInfoConsumersReply return type. Read more
Source§

fn xinfo_groups<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Returns all consumer groups created for a given stream key. Take note of the StreamInfoGroupsReply return type. Read more
Source§

fn xinfo_stream<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Returns info about high-level stream details (first & last message id, length, number of groups, etc.) Take note of the StreamInfoStreamReply return type. Read more
Source§

fn xlen<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

Returns the number of messages for a given stream key. Read more
Source§

fn xpending<'a, K, G, RV>(&mut self, key: K, group: G) -> Result<RV, RedisError>

This is a basic version of making XPENDING command calls which only passes a stream key and consumer group and it returns details about which consumers have pending messages that haven’t been acked. Read more
Source§

fn xpending_count<'a, K, G, S, E, C, RV>( &mut self, key: K, group: G, start: S, end: E, count: C, ) -> Result<RV, RedisError>

This XPENDING version returns a list of all messages over the range. You can use this for paginating pending messages (but without the message HashMap). Read more
Source§

fn xpending_consumer_count<'a, K, G, S, E, C, CN, RV>( &mut self, key: K, group: G, start: S, end: E, count: C, consumer: CN, ) -> Result<RV, RedisError>

An alternate version of xpending_count which filters by consumer name. Read more
Source§

fn xrange<'a, K, S, E, RV>( &mut self, key: K, start: S, end: E, ) -> Result<RV, RedisError>

Returns a range of messages in a given stream key. Read more
Source§

fn xrange_all<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

A helper method for automatically returning all messages in a stream by key. Use with caution! Read more
Source§

fn xrange_count<'a, K, S, E, C, RV>( &mut self, key: K, start: S, end: E, count: C, ) -> Result<RV, RedisError>

A method for paginating a stream by key. Read more
Source§

fn xread<'a, K, ID, RV>( &mut self, keys: &'a [K], ids: &'a [ID], ) -> Result<RV, RedisError>

Read a list of ids for each stream key. This is the basic form of reading streams. For more advanced control, like blocking, limiting, or reading by consumer group, see xread_options. Read more
Source§

fn xread_options<'a, K, ID, RV>( &mut self, keys: &'a [K], ids: &'a [ID], options: &'a StreamReadOptions, ) -> Result<RV, RedisError>

This method handles setting optional arguments for XREAD or XREADGROUP Redis commands. Read more
Source§

fn xrevrange<'a, K, E, S, RV>( &mut self, key: K, end: E, start: S, ) -> Result<RV, RedisError>

This is the reverse version of xrange. The same rules apply for start and end here. Read more
Source§

fn xrevrange_all<'a, K, RV>(&mut self, key: K) -> Result<RV, RedisError>

This is the reverse version of xrange_all. The same rules apply for start and end here. Read more
Source§

fn xrevrange_count<'a, K, E, S, C, RV>( &mut self, key: K, end: E, start: S, count: C, ) -> Result<RV, RedisError>

This is the reverse version of xrange_count. The same rules apply for start and end here. Read more
Source§

fn xtrim<'a, K, RV>( &mut self, key: K, maxlen: StreamMaxlen, ) -> Result<RV, RedisError>

Trim a stream key to a MAXLEN count. Read more
Source§

fn xtrim_options<'a, K, RV>( &mut self, key: K, options: &'a StreamTrimOptions, ) -> Result<RV, RedisError>

Trim a stream key with full options Read more
Source§

fn invoke_script<'a, RV>( &mut self, invocation: &'a ScriptInvocation<'a>, ) -> Result<RV, RedisError>
where RV: FromRedisValue,

Adds a prepared script command to the pipeline. Read more
Source§

fn flushall<'a, RV>(&mut self) -> Result<RV, RedisError>
where RV: FromRedisValue,

Deletes all the keys of all databases Read more
Source§

fn flushall_options<'a, RV>( &mut self, options: &'a FlushAllOptions, ) -> Result<RV, RedisError>
where RV: FromRedisValue,

Deletes all the keys of all databases with options Read more
Source§

fn flushdb<'a, RV>(&mut self) -> Result<RV, RedisError>
where RV: FromRedisValue,

Deletes all the keys of the current database Read more
Source§

fn flushdb_options<'a, RV>( &mut self, options: &'a FlushAllOptions, ) -> Result<RV, RedisError>
where RV: FromRedisValue,

Deletes all the keys of the current database with options Read more
Source§

fn scan<RV>(&mut self) -> Result<Iter<'_, RV>, RedisError>
where RV: FromRedisValue,

Incrementally iterate the keys space.
Source§

fn scan_options<RV>( &mut self, opts: ScanOptions, ) -> Result<Iter<'_, RV>, RedisError>
where RV: FromRedisValue,

Incrementally iterate the keys space with options.
Source§

fn scan_match<P, RV>(&mut self, pattern: P) -> Result<Iter<'_, RV>, RedisError>

Incrementally iterate the keys space for keys matching a pattern.
Source§

fn hscan<K, RV>(&mut self, key: K) -> Result<Iter<'_, RV>, RedisError>

Incrementally iterate hash fields and associated values.
Source§

fn hscan_match<K, P, RV>( &mut self, key: K, pattern: P, ) -> Result<Iter<'_, RV>, RedisError>

Incrementally iterate hash fields and associated values for field names matching a pattern.
Source§

fn sscan<K, RV>(&mut self, key: K) -> Result<Iter<'_, RV>, RedisError>

Incrementally iterate set elements.
Source§

fn sscan_match<K, P, RV>( &mut self, key: K, pattern: P, ) -> Result<Iter<'_, RV>, RedisError>

Incrementally iterate set elements for elements matching a pattern.
Source§

fn zscan<K, RV>(&mut self, key: K) -> Result<Iter<'_, RV>, RedisError>

Incrementally iterate sorted set elements.
Source§

fn zscan_match<K, P, RV>( &mut self, key: K, pattern: P, ) -> Result<Iter<'_, RV>, RedisError>

Incrementally iterate sorted set elements for elements matching a pattern.
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<C, T> ConnectionLike for T
where C: ConnectionLike, T: DerefMut<Target = C>,

Source§

fn req_packed_command(&mut self, cmd: &[u8]) -> Result<Value, RedisError>

Sends an already encoded (packed) command into the TCP socket and reads the single response from it.
Source§

fn req_packed_commands( &mut self, cmd: &[u8], offset: usize, count: usize, ) -> Result<Vec<Value>, RedisError>

Source§

fn req_command(&mut self, cmd: &Cmd) -> Result<Value, RedisError>

Sends a Cmd into the TCP socket and reads a single response from it.
Source§

fn get_db(&self) -> i64

Returns the database this connection is bound to. Note that this information might be unreliable because it’s initially cached and also might be incorrect if the connection like object is not actually connected.
Source§

fn supports_pipelining(&self) -> bool

Source§

fn check_connection(&mut self) -> bool

Check that all connections it has are available (PING internally).
Source§

fn is_open(&self) -> bool

Returns the connection status. Read more
Source§

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

Source§

type Iter = Once<T>

An iterator over the items within this container, by value.
Source§

fn get_iter(&self) -> <T as Container<T>>::Iter

Iterate over the elements of the container (using internal iteration because GATs are unstable).
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<R> Rng for R
where R: RngCore + ?Sized,

Source§

fn random<T>(&mut self) -> T

Return a random value via the StandardUniform distribution. Read more
Source§

fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>

Return an iterator over random variates Read more
Source§

fn random_range<T, R>(&mut self, range: R) -> T
where T: SampleUniform, R: SampleRange<T>,

Generate a random value in the given range. Read more
Source§

fn random_bool(&mut self, p: f64) -> bool

Return a bool with a probability p of being true. Read more
Source§

fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool

Return a bool with a probability of numerator/denominator of being true. Read more
Source§

fn sample<T, D>(&mut self, distr: D) -> T
where D: Distribution<T>,

Sample a new value, using the given distribution. Read more
Source§

fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>
where D: Distribution<T>, Self: Sized,

Create an iterator that generates values using the given distribution. Read more
Source§

fn fill<T>(&mut self, dest: &mut T)
where T: Fill + ?Sized,

Fill any type implementing Fill with random data Read more
Source§

fn gen<T>(&mut self) -> T

👎Deprecated since 0.9.0: Renamed to random to avoid conflict with the new gen keyword in Rust 2024.
Alias for Rng::random.
Source§

fn gen_range<T, R>(&mut self, range: R) -> T
where T: SampleUniform, R: SampleRange<T>,

👎Deprecated since 0.9.0: Renamed to random_range
Source§

fn gen_bool(&mut self, p: f64) -> bool

👎Deprecated since 0.9.0: Renamed to random_bool
Alias for Rng::random_bool.
Source§

fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool

👎Deprecated since 0.9.0: Renamed to random_ratio
Source§

impl<T> RngCore for T
where T: DerefMut, <T as Deref>::Target: RngCore,

Source§

fn next_u32(&mut self) -> u32

Return the next random u32. Read more
Source§

fn next_u64(&mut self) -> u64

Return the next random u64. Read more
Source§

fn fill_bytes(&mut self, dst: &mut [u8])

Fill dest with random data. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<R> TryRngCore for R
where R: RngCore + ?Sized,

Source§

type Error = Infallible

The type returned in the event of a RNG error.
Source§

fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>

Return the next random u32.
Source§

fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>

Return the next random u64.
Source§

fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>

Fill dest entirely with random data.
Source§

fn unwrap_err(self) -> UnwrapErr<Self>
where Self: Sized,

Wrap RNG with the UnwrapErr wrapper.
Source§

fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>

Wrap RNG with the UnwrapMut wrapper.
Source§

fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>
where Self: Sized,

Convert an RngCore to a RngReadAdapter.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> CryptoRng for T
where T: DerefMut, <T as Deref>::Target: CryptoRng,

Source§

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

Source§

impl<T> Formattable for T
where T: Deref, <T as Deref>::Target: Formattable,

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

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

Source§

impl<T> Parsable for T
where T: Deref, <T as Deref>::Target: Parsable,

Source§

impl<T> RuleType for T
where T: Copy + Debug + Eq + Hash + Ord,

Source§

impl<R> TryCryptoRng for R
where R: CryptoRng + ?Sized,