Struct BussHeader

Source
pub struct BussHeader {
    pub magic_number: u32,
    pub version_major: u8,
    pub version_minor: u8,
    pub action: BussAction,
    pub flags: u8,
}
Expand description

The protocol header

Fields§

§magic_number: u32

Set to 0x00042069. The server/client should check if the first 4 bytes matches these sequence. Otherwise should cancel the request and respond with an error. If you see this, we are bussin.

§version_major: u8

Bussin protocol version number. e.g. if currently at version 69.1 it will be the 69 part

§version_minor: u8

Bussing protocol version number minor. e.g. if currently at version 69.1 it will be the 1 part

§action: BussAction

Action the client wants executed or what response code the server replied with.

§flags: u8

Flags that describe the binary content of the protocol

Implementations§

Source§

impl BussHeader

Source

pub fn new() -> Self

Create new head

Source

pub fn set_action(&mut self, action: BussAction)

Sets the action to be performed

Trait Implementations§

Source§

impl Default for BussHeader

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl FromBytes<&[u8; 8]> for BussHeader

Source§

fn from_bytes(bytes: &[u8; 8]) -> Self

get a type from the sized byte array
Source§

impl ToBytes for BussHeader

Source§

fn to_bytes(self) -> Vec<u8>

Convert to bytes

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.