pub struct Argv { /* private fields */ }Expand description
A command’s arguments, and the decoder that fills them.
One per connection, reused for the life of the connection. After the first few commands it has the capacity it needs and never allocates again.
Implementations§
Source§impl Argv
impl Argv
Sourcepub fn with_capacity(n: usize) -> Argv
pub fn with_capacity(n: usize) -> Argv
An empty one with room for n arguments already reserved.
Worth doing at accept time. The first command on a connection is the only one that would otherwise allocate.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Forgets everything, including any half read command.
The connection calls this if it discards unread bytes for any reason, because the resume state is an offset into a buffer that is about to stop being the same buffer.
Sourcepub fn arg<'a>(&'a self, buf: &'a [u8], i: usize) -> Option<&'a [u8]>
pub fn arg<'a>(&'a self, buf: &'a [u8], i: usize) -> Option<&'a [u8]>
Argument i, or None if there are fewer than that many.
buf must be the same buffer that was decoded and must not have been
drained since.
Sourcepub fn args<'a>(&'a self, buf: &'a [u8]) -> impl Iterator<Item = &'a [u8]>
pub fn args<'a>(&'a self, buf: &'a [u8]) -> impl Iterator<Item = &'a [u8]>
Every argument in order.
Sourcepub fn decode(
&mut self,
buf: &[u8],
limits: &Limits,
) -> Result<Step, ProtocolError>
pub fn decode( &mut self, buf: &[u8], limits: &Limits, ) -> Result<Step, ProtocolError>
Reads one command from the front of buf.
§Errors
Any ProtocolError. Redis closes the connection after one of these
and so should the caller: a protocol error means the two ends no longer
agree on where the next frame starts, and there is no recovering from
that by reading further.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Argv
impl RefUnwindSafe for Argv
impl Send for Argv
impl Sync for Argv
impl Unpin for Argv
impl UnsafeUnpin for Argv
impl UnwindSafe for Argv
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
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> ⓘ
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> ⓘ
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