pub struct Command {
pub entity: u8,
pub action: u8,
pub data: Option<Vec<u8>>,
}Fields§
§entity: u8§action: u8§data: Option<Vec<u8>>Implementations§
Source§impl Command
impl Command
pub fn new(entity: u8, action: u8, data: Option<Vec<u8>>) -> Self
pub fn serialize(&self) -> Result<Vec<u8>>
pub fn deserialize(bytes: &[u8]) -> Result<Self>
Sourcepub fn to_bytes(
entity: Entity,
action: Action,
data: Option<Vec<u8>>,
) -> Result<Vec<u8>>
pub fn to_bytes( entity: Entity, action: Action, data: Option<Vec<u8>>, ) -> Result<Vec<u8>>
send = build + encode (protocol layer, no IO)
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Command>
pub fn from_bytes(bytes: &[u8]) -> Result<Command>
receive = decode from wire bytes
pub async fn send( &self, context: Arc<Context>, client_type: &ClientType, version: u8, ) -> Result<()>
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for Command
impl<'__de, __Context> BorrowDecode<'__de, __Context> for Command
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
impl StructuralPartialEq for Command
Auto Trait Implementations§
impl Forget for Command
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnsafeUnpin for Command
impl UnwindSafe for Command
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