* protocol: extract response type * deps: drop lazy_static and regex * protocol: extract request commands * protocol: create a struct for... ...formatting and parsing sonic protocol * protocol: refac flush command * commands: introduce dest, refac push and count * commands: refac all commands * commands: add convinient methods * doc: add documentation for each new structs * doc: change examples in the readme * commands: implement from trait for count and flush * commands: change pag logic
21 lines
628 B
Rust
21 lines
628 B
Rust
macro_rules! init_command {
|
|
(
|
|
$(#[$outer:meta])*
|
|
use $cmd_name:ident
|
|
for fn $fn_name:ident $(<$($lt:lifetime)+>)? (
|
|
$($arg_name:ident : $arg_type:ty $( => $arg_value:expr)?,)*
|
|
)
|
|
$(;)?
|
|
) => {
|
|
$(#[$outer])*
|
|
pub fn $fn_name $(<$($lt)+>)? (
|
|
&self,
|
|
$($arg_name: $arg_type),*
|
|
) -> $crate::result::Result<
|
|
<$cmd_name as $crate::commands::StreamCommand>::Response,
|
|
> {
|
|
let command = $cmd_name { $($arg_name $(: $arg_value)?,)* };
|
|
self.stream().run_command(command)
|
|
}
|
|
};
|
|
}
|