#[non_exhaustive]pub enum Role {
Primary {
replication_offset: u64,
replicas: Vec<ReplicaInfo>,
},
Replica {
primary_ip: String,
primary_port: u16,
replication_state: String,
data_received: u64,
},
Sentinel {
primary_names: Vec<String>,
},
}Expand description
High level representation of response to the ROLE command.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Primary
Represents a primary role, which is master in legacy Redis terminology.
Fields
§
replicas: Vec<ReplicaInfo>List of replica, each represented by a tuple of IP, port and the last acknowledged replication offset.
Replica
Represents a replica role, which is slave in legacy Redis terminology.
Fields
Sentinel
Represents a sentinel role.
Trait Implementations§
Source§impl FromRedisValue for Role
impl FromRedisValue for Role
Source§fn from_redis_value_ref(v: &Value) -> Result<Self, ParsingError>
fn from_redis_value_ref(v: &Value) -> Result<Self, ParsingError>
Given a redis
Value this attempts to convert it into the given
destination type. If that fails because it’s not compatible an
appropriate error is generated.Source§fn from_redis_value(v: Value) -> Result<Self, ParsingError>
fn from_redis_value(v: Value) -> Result<Self, ParsingError>
Given a redis
Value this attempts to convert it into the given
destination type. If that fails because it’s not compatible an
appropriate error is generated.Source§fn from_redis_value_refs(items: &[Value]) -> Result<Vec<Self>, ParsingError>
fn from_redis_value_refs(items: &[Value]) -> Result<Vec<Self>, ParsingError>
Similar to
from_redis_value_ref but constructs a vector of objects
from another vector of values. This primarily exists internally
to customize the behavior for vectors of tuples.Source§fn from_redis_values(items: Vec<Value>) -> Result<Vec<Self>, ParsingError>
fn from_redis_values(items: Vec<Value>) -> Result<Vec<Self>, ParsingError>
The same as
from_redis_value_refs, but takes a Vec<Value> instead
of a &[Value].Source§fn from_each_redis_values(items: Vec<Value>) -> Vec<Result<Self, ParsingError>>
fn from_each_redis_values(items: Vec<Value>) -> Vec<Result<Self, ParsingError>>
The same as
from_redis_values, but returns a result for each
conversion to make handling them case-by-case possible.Source§fn from_byte_slice(_vec: &[u8]) -> Option<Vec<Self>>
fn from_byte_slice(_vec: &[u8]) -> Option<Vec<Self>>
Convert bytes to a single element vector.
Source§fn from_byte_vec(_vec: Vec<u8>) -> Result<Vec<Self>, ParsingError>
fn from_byte_vec(_vec: Vec<u8>) -> Result<Vec<Self>, ParsingError>
Convert bytes to a single element vector.
impl Eq for Role
impl StructuralPartialEq for Role
Auto Trait Implementations§
impl Freeze for Role
impl RefUnwindSafe for Role
impl Send for Role
impl Sync for Role
impl Unpin for Role
impl UnwindSafe for Role
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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