Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
d27f07ce75
|
@@ -195,6 +195,12 @@ macro_rules! empty_command_request {
|
||||
}
|
||||
}
|
||||
|
||||
impl $name {
|
||||
pub fn req() -> <Self as crate::commands::Command>::Request {
|
||||
paste::paste! { [<$name Request>] }
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::commands::CommandRequest for paste::paste! { [<$name Request>] } {
|
||||
const COMMAND: &'static str = $command_name;
|
||||
const MIN_ARGS: u32 = 0;
|
||||
@@ -228,6 +234,12 @@ macro_rules! empty_command_response {
|
||||
}
|
||||
}
|
||||
|
||||
impl $name {
|
||||
pub fn res() -> <Self as crate::commands::Command>::Response {
|
||||
paste::paste! { [<$name Response>] }
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::commands::CommandResponse for paste::paste! { [<$name Response>] } {
|
||||
fn parse(
|
||||
_parts: crate::commands::ResponseAttributes<'_>,
|
||||
@@ -254,6 +266,12 @@ macro_rules! single_item_command_request {
|
||||
}
|
||||
}
|
||||
|
||||
impl $name {
|
||||
pub fn req(item: $item_type) -> <Self as crate::commands::Command>::Request {
|
||||
<Self as crate::commands::Command>::Request::new(item)
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::commands::CommandRequest for paste::paste! { [<$name Request>] } {
|
||||
const COMMAND: &'static str = $command_name;
|
||||
const MIN_ARGS: u32 = 1;
|
||||
@@ -299,6 +317,12 @@ macro_rules! single_optional_item_command_request {
|
||||
}
|
||||
}
|
||||
|
||||
impl $name {
|
||||
pub fn req(item: Option<$item_type>) -> <Self as crate::commands::Command>::Request {
|
||||
<Self as crate::commands::Command>::Request::new(item)
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::commands::CommandRequest for paste::paste! { [<$name Request>] } {
|
||||
const COMMAND: &'static str = $command_name;
|
||||
const MIN_ARGS: u32 = 0;
|
||||
@@ -350,6 +374,12 @@ macro_rules! single_item_command_response {
|
||||
}
|
||||
}
|
||||
|
||||
impl $name {
|
||||
pub fn res(item: $item_type) -> <Self as crate::commands::Command>::Response {
|
||||
<Self as crate::commands::Command>::Response::new(item)
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::commands::CommandResponse for paste::paste! { [<$name Response>] } {
|
||||
fn parse(
|
||||
parts: crate::commands::ResponseAttributes<'_>,
|
||||
@@ -394,6 +424,12 @@ macro_rules! multi_item_command_response {
|
||||
}
|
||||
}
|
||||
|
||||
impl $name {
|
||||
pub fn res(items: Vec<$item_type>) -> <Self as crate::commands::Command>::Response {
|
||||
<Self as crate::commands::Command>::Response::new(items)
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::commands::CommandResponse for paste::paste! { [<$name Response>] } {
|
||||
fn parse(
|
||||
parts: crate::commands::ResponseAttributes<'_>,
|
||||
|
||||
Reference in New Issue
Block a user