pub enum Op {
INFO(ServerInfo),
CONNECT(ConnectCommand),
PUB(PubCommand),
SUB(SubCommand),
UNSUB(UnsubCommand),
MSG(Message),
PING,
PONG,
OK,
ERR(ServerError),
}
Expand description
Abstraction over NATS protocol messages
Variants§
INFO(ServerInfo)
SERVER Sent to client after initial TCP/IP connection
CONNECT(ConnectCommand)
CLIENT Sent to server to specify connection information
PUB(PubCommand)
CLIENT Publish a message to a subject, with optional reply subject
SUB(SubCommand)
CLIENT Subscribe to a subject (or subject wildcard)
UNSUB(UnsubCommand)
CLIENT Unsubscribe (or auto-unsubscribe) from subject
MSG(Message)
SERVER Delivers a message payload to a subscriber
PING
BOTH PING keep-alive message
PONG
BOTH PONG keep-alive message
OK
SERVER Acknowledges well-formed protocol message in verbose
mode
ERR(ServerError)
SERVER Indicates a protocol error. May cause client disconnect.
Implementations§
Source§impl Op
impl Op
Sourcepub fn into_bytes(self) -> Result<Bytes, CommandError>
pub fn into_bytes(self) -> Result<Bytes, CommandError>
Transforms the OP into a byte slice
Sourcepub fn from_bytes(cmd_name: &[u8], buf: &[u8]) -> Result<Self, CommandError>
pub fn from_bytes(cmd_name: &[u8], buf: &[u8]) -> Result<Self, CommandError>
Tries to parse from a pair of command name and whole buffer
Trait Implementations§
impl StructuralPartialEq for Op
Auto Trait Implementations§
impl !Freeze for Op
impl RefUnwindSafe for Op
impl Send for Op
impl Sync for Op
impl Unpin for Op
impl UnwindSafe for Op
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