-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Example:
A very common way to answer a handle message is simply { "status": "success" } or { "status": "failure" }.
Every time we do that we have to write something along the lines of:
Ok(HandleResponse {
messages,
log: vec![],
data: Some(to_binary(&HandleAnswer::Send { status: Success })?),
})For this we of course have to declare:
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
#[serde(rename_all = "snake_case")]
pub enum ResponseStatus {
Success,
Failure,
}
#[derive(Serialize, Deserialize, JsonSchema, Debug)]
#[serde(rename_all = "snake_case")]
pub enum HandleAnswer {
Send {
status: ResponseStatus,
},
...
}This is a lot of code and it's kind of annoying.
We should provide a standard implementation for common use cases that coders can use as a one-liner.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers