message_stub.rs

Overview

This file defines a test-only stub implementation of the Message trait, named MessageStub. It provides a simplified, serializable message structure primarily designed for use in testing scenarios. The stub encapsulates an account_id which serves as the message's destination identifier.

The MessageStub struct is conditionally compiled only for tests (#[cfg(test)]), ensuring it does not affect production code. It implements serialization and deserialization traits (Serialize, Deserialize) to facilitate easy conversion to and from formats such as JSON, beneficial for test data setup and verification.

Structs and Implementations

MessageStub

pub struct MessageStub {
    account_id: u64,
}

Methods

impl Message for MessageStub

This implementation allows MessageStub to fulfill the Message trait contract.

Implementation Details

Interaction With Other System Components

Mermaid Diagram

classDiagram
class MessageStub {
-account_id: u64
+new()
+destination()
}
MessageStub ..|> Message