Struct open_protocol::command::Command
[−]
[src]
pub struct Command { pub arg: CommandArgs, pub set: CmdSet, pub enc: u8, pub session_id: Option<u8>, pub seq: u16, }
For building a commnd frame.
Example
use open_protocol::command::{Command, CmdSet, Activation}; use open_protocol::types::{CommandArgs}; use std::io::Cursor; let version_data = CommandArgs::version(); let key = b"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabca"; let mut cmd = Command::new(CmdSet::Activation(Activation::Version), version_data, false, 1); cmd.set_session_id(3); let mut buf = Cursor::new(Vec::new()); cmd.write(&mut buf, key).unwrap();
Fields
arg: CommandArgs
command args
set: CmdSet
command set
enc: u8
whether the command is encoded
session_id: Option<u8>
command session id
seq: u16
command sequence
Methods
impl Command
[src]
fn new(set: CmdSet, arg: CommandArgs, enc: bool, seq: u16) -> Command
fn set_seq(&mut self, seq: u16)
fn set_session_id(&mut self, session_id: u8)
fn gen_bytes(&self, key: &[u8]) -> Result<Vec<u8>>
fn write<W: Write>(&self, writer: &mut W, key: &[u8]) -> Result<()>
Trait Implementations
impl Clone for Command
[src]
fn clone(&self) -> Command
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more