Struct rtj::Message[][src]

pub struct Message {
    pub header: Header,
    pub payload: Vec<u8>,
}
Expand description

Provides a container for Header and Serialized and/or Encrypted Job payloads.

Fields

header: Headerpayload: Vec<u8>

Implementations

Creates a new Message with default values

Sets the Message header field

This method can only be called after Message::set_payload as the header itself contains the size of the payload in bytes.

Public key bytes to be sent in the Header must be the public part of the sender’s SecretKey.

Sets the Message payload field.

Encrypts and resets the Message payload field using the specified PublicKey of the recipient and SecretKey of the sender.

The Header is updated to:

  • Reflect the new payload length
  • Set the encrypted flag

Payload is encrypted for the given pubkey. Encryption is done using crypto_box in its default configuration.

Decrypts and resets the Message payload using the specified SecretKey

Payload is decrypted for the pubkey specified in the Message header. Decryption is done using crypto_box in its default configuration.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Deserialize this value from the given Serde deserializer. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

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

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

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

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

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.