pub struct Message {
    /// The underlying raw data of the message.
    bytes: Bytes,
}
Expand description

Normalized (hashed) message authenticated by a signature.

Fields

bytes: Bytes

The underlying raw data of the message.

Implementations

pub fn new() -> Self

Creates a new instance of a Message.

Returns

[Message] - A new, empty Message.

Examples

use std::crypto::Message;

fn foo() {
    let new_message = Message::new();
    assert(new_message.bytes().len() == 0);
}

pub fn bytes(self) -> Bytes

Returns the underlying raw Bytes data of the signature.

Returns

  • [Bytes] - The raw data of the signature.

Examples

use std::crypto::Message;

fn foo() -> {
    let new_message = Message::new();
    assert(new_message.bytes().len() == 0);
}

Trait Implementations

pub fn abi_encode(self, buffer: Buffer) -> Buffer

pub fn abi_decode(refmut buffer: BufferReader) -> Self

pub fn from(bits: b256) -> Self

pub fn from(bytes: Bytes) -> Self

pub fn try_into(self) -> Option<b256>

pub fn eq(self, other: Self) -> bool

pub fn neq(self, other: Self) -> bool

Evaluates if two values of the same type are not equal.

Additional Information

This function is inherited when eq() is implemented.

Arguments

  • other: [Self] - The value of the same type.

Returns

  • [bool] - true if the two values are not equal, otherwise false.

Examples

struct MyStruct {
    val: u64,
}

impl Eq for MyStruct {
    fn eq(self, other: Self) -> bool {
         self.val == other.val
    }
}

fn foo() {
    let struct1 = MyStruct { val: 10 };
    let struct2 = MyStruct { val: 2 };
    let result = struct1 != struct2;
    assert(result);
}

pub fn hash(
self,
refmut state: Hasher,
)