pub struct Cmd { /* private fields */ }Expand description
A command to send to the server.
Build a command, then send it with one of:
crate::AsyncCommands::glide_send_command_ascrate::AsyncCommands::glide_send_commandcrate::Commands::glide_send_command_ascrate::Commands::glide_send_command
use glide::AsyncCommands;
let set = glide::cmd("SET").arg("my_key").arg(42).clone();
let _: () = client.glide_send_command_as(set).await?;
let get = glide::cmd("GET").arg("my_key").clone();
let value: i64 = client.glide_send_command_as(get).await?;
Mirrors redis-rs’s Cmd.
Implementations§
Source§impl Cmd
impl Cmd
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty command.
It is recommended to use cmd instead
to explicitly specify the command keyword.
Sourcepub fn arg<A: ToValkeyArgs>(&mut self, arg: A) -> &mut Self
pub fn arg<A: ToValkeyArgs>(&mut self, arg: A) -> &mut Self
Append an argument and return &mut self for chaining.
Sourcepub fn query_async<'a, RV: FromValkeyValue>(
&self,
con: &'a impl AsyncCommands,
) -> ValkeyFuture<'a, RV>
pub fn query_async<'a, RV: FromValkeyValue>( &self, con: &'a impl AsyncCommands, ) -> ValkeyFuture<'a, RV>
Execute this command on an async GLIDE client.
use glide::cmd;
let v: i64 = cmd("GET").arg("k").query_async(client).await?;Mirrors redis-rs’s query_async.
Sourcepub fn exec_async<'a>(
&self,
con: &'a impl AsyncCommands,
) -> ValkeyFuture<'a, ()>
pub fn exec_async<'a>( &self, con: &'a impl AsyncCommands, ) -> ValkeyFuture<'a, ()>
Execute this command on an async GLIDE client, discarding the reply.
Mirrors redis-rs’s exec_async.
Sourcepub fn query<RV: FromValkeyValue>(
&self,
con: &impl Commands,
) -> ValkeyResult<RV>
pub fn query<RV: FromValkeyValue>( &self, con: &impl Commands, ) -> ValkeyResult<RV>
Execute this command on a blocking GLIDE client.
use glide::cmd;
use glide::sync::SyncGlideClient;
let v: i64 = cmd("GET").arg("k").query(client)?;Mirrors redis-rs’s query.
Sourcepub fn exec(&self, con: &impl Commands) -> ValkeyResult<()>
pub fn exec(&self, con: &impl Commands) -> ValkeyResult<()>
Execute this command on a blocking GLIDE client, discarding the reply.
Mirrors redis-rs’s exec.
Trait Implementations§
Source§impl ValkeyWrite for Cmd
impl ValkeyWrite for Cmd
Source§fn write_arg_fmt(&mut self, arg: impl Display)
fn write_arg_fmt(&mut self, arg: impl Display)
Append a single argument formatted via
std::fmt::Display.Auto Trait Implementations§
impl !Freeze for Cmd
impl RefUnwindSafe for Cmd
impl Send for Cmd
impl Sync for Cmd
impl Unpin for Cmd
impl UnsafeUnpin for Cmd
impl UnwindSafe for Cmd
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.