Struct rtj::Header

source ·
pub struct Header {
    pub msgtype: u8,
    pub psize: u32,
    pub pubkey: [u8; 32],
    pub nonce: [u8; 24],
    pub encrypted: bool,
}
Expand description

Header contains identifying information about the Job that follows.

Specifically this contains the fields:

  • msgtype, the Job type: u8
  • psize, the following payload size in bytes as: u32
  • pubkey, the crypto-box pubkey of the sender as: [u8; 32]
  • nonce, the message nonce as: [u8; 24]
  • encrypted, bool indicating the encryption status of the following payload.

Fields§

§msgtype: u8§psize: u32§pubkey: [u8; 32]§nonce: [u8; 24]§encrypted: bool

Implementations§

source§

impl Header

source

pub fn new() -> Header

Creates a new Header with default values

source

pub fn set_msgtype<T: Into<u8>>(self, msgtype: T) -> Header

Sets the value of msgtype.

source

pub fn set_psize<T: Into<u32>>(self, psize: T) -> Header

Sets the value of psize.

source

pub fn set_pubkey<T: Into<[u8; 32]>>(self, pubkey: T) -> Header

Sets the value of pubkey.

source

pub fn set_nonce<T: RngCore + CryptoRng>( self, csprng: &mut T ) -> Result<Header, RtjError>

Sets the value of nonce by generating one using the specified csprng.

source

pub fn set_encrypted(self, encrypted: bool) -> Header

Sets the value of encrypted.

source

pub fn to_bytes(self) -> [u8; 64]

Returns Header as a byte array [u8; 64].

Trait Implementations§

source§

impl Clone for Header

source§

fn clone(&self) -> Header

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Header

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Header

source§

fn default() -> Header

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

impl<'de> Deserialize<'de> for Header

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for Header

source§

fn eq(&self, other: &Header) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Header

source§

fn partial_cmp(&self, other: &Header) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for Header

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Copy for Header

source§

impl StructuralPartialEq for Header

Auto Trait Implementations§

§

impl Freeze for Header

§

impl RefUnwindSafe for Header

§

impl Send for Header

§

impl Sync for Header

§

impl Unpin for Header

§

impl UnwindSafe for Header

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,