fmt (#34)
This commit is contained in:
@@ -17,7 +17,9 @@ pub struct Get {
|
||||
impl Get {
|
||||
/// Create a new `Get` command which fetches `key`.
|
||||
pub(crate) fn new(key: impl ToString) -> Get {
|
||||
Get { key: key.to_string() }
|
||||
Get {
|
||||
key: key.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a `Get` instance from a received frame.
|
||||
|
||||
@@ -25,7 +25,7 @@ pub(crate) enum Command {
|
||||
Set(Set),
|
||||
Subscribe(Subscribe),
|
||||
Unsubscribe(Unsubscribe),
|
||||
Unknown(Unknown)
|
||||
Unknown(Unknown),
|
||||
}
|
||||
|
||||
impl Command {
|
||||
@@ -66,7 +66,7 @@ impl Command {
|
||||
// the command is not recognized, there is most likely
|
||||
// unconsumed fields remaining in the `Parse` instance.
|
||||
return Ok(Command::Unknown(Unknown::new(command_name)));
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
// Check if there is any remaining unconsumed fields in the `Parse`
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::{Connection, Db, Frame};
|
||||
use crate::cmd::{Parse, ParseError};
|
||||
use crate::{Connection, Db, Frame};
|
||||
|
||||
use bytes::Bytes;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -27,7 +27,9 @@ pub struct Unsubscribe {
|
||||
impl Subscribe {
|
||||
/// Creates a new `Subscribe` command to listen on the specified channels.
|
||||
pub(crate) fn new(channels: &[String]) -> Subscribe {
|
||||
Subscribe { channels: channels.to_vec() }
|
||||
Subscribe {
|
||||
channels: channels.to_vec(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a `Subscribe` instance from a received frame.
|
||||
@@ -221,7 +223,9 @@ impl Subscribe {
|
||||
impl Unsubscribe {
|
||||
/// Create a new `Unsubscribe` command with the given `channels`.
|
||||
pub(crate) fn new(channels: &[String]) -> Unsubscribe {
|
||||
Unsubscribe { channels: channels.to_vec() }
|
||||
Unsubscribe {
|
||||
channels: channels.to_vec(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a `Unsubscribe` instance from a received frame.
|
||||
|
||||
@@ -12,7 +12,9 @@ impl Unknown {
|
||||
/// Create a new `Unknown` command which responds to unknown commands
|
||||
/// issued by clients
|
||||
pub(crate) fn new(key: impl ToString) -> Unknown {
|
||||
Unknown { command_name: key.to_string() }
|
||||
Unknown {
|
||||
command_name: key.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the command name
|
||||
|
||||
Reference in New Issue
Block a user