pub trait Resp2Frame:
Debug
+ Hash
+ Eq {
Show 15 methods
// Required methods
fn take(&mut self) -> Self;
fn kind(&self) -> FrameKind;
fn as_str(&self) -> Option<&str>;
fn as_bool(&self) -> Option<bool>;
fn as_bytes(&self) -> Option<&[u8]>;
fn to_string(&self) -> Option<String>;
fn encode_len(&self, int_as_bulkstring: bool) -> usize;
fn is_normal_pubsub_message(&self) -> bool;
fn is_pattern_pubsub_message(&self) -> bool;
fn is_shard_pubsub_message(&self) -> bool;
fn is_single_element_vec(&self) -> bool;
fn pop_or_take(self) -> Self;
// Provided methods
fn is_redirection(&self) -> bool { ... }
fn as_f64(&self) -> Option<f64> { ... }
fn convert<T>(self) -> Result<T, RedisProtocolError>
where Self: Sized,
T: FromResp2<Self> { ... }
}
Available on crate feature
resp2
only.Expand description
Generic operations on a RESP2 frame.
Required Methods§
Sourcefn encode_len(&self, int_as_bulkstring: bool) -> usize
fn encode_len(&self, int_as_bulkstring: bool) -> usize
Read the number of bytes needed to encode this frame.
Sourcefn is_normal_pubsub_message(&self) -> bool
fn is_normal_pubsub_message(&self) -> bool
Whether the frame is a message from a subscribe
call.
Sourcefn is_pattern_pubsub_message(&self) -> bool
fn is_pattern_pubsub_message(&self) -> bool
Whether the frame is a message from a psubscribe
call.
Sourcefn is_shard_pubsub_message(&self) -> bool
fn is_shard_pubsub_message(&self) -> bool
Whether the frame is a message from a ssubscribe
call.
Sourcefn is_single_element_vec(&self) -> bool
Available on crate feature convert
only.
fn is_single_element_vec(&self) -> bool
convert
only.Whether frame is a bulk array with a single element.
Sourcefn pop_or_take(self) -> Self
Available on crate feature convert
only.
fn pop_or_take(self) -> Self
convert
only.Pop an element from the inner array or return the original frame.
This function is intended to be used with Self::is_single_element_vec and may panic.
Provided Methods§
Sourcefn is_redirection(&self) -> bool
fn is_redirection(&self) -> bool
Whether the frame is a MOVED
or ASK
redirection.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.