Skip to main content

xrpl_common_stdlib/types/
message.rs

1//! A message whose signature is being verified.
2
3/// A message whose signature is checked by [`check_sig`](crate::crypto::check_sig).
4///
5/// This is a thin, zero-copy newtype around a byte slice. Its only purpose is to give the
6/// message argument a distinct type from the signature argument (see [`Signature`]), so a
7/// caller who swaps the two is caught at compile time rather than silently getting a wrong
8/// answer at runtime.
9///
10/// [`Signature`]: crate::types::signature::Signature
11///
12/// ## Derived Traits
13///
14/// - `Copy`: the newtype only borrows a slice, so copying is trivial
15/// - `PartialEq, Eq`: enable comparisons
16/// - `Debug, Clone`: standard traits for development and consistency
17#[derive(Debug, Clone, Copy, PartialEq, Eq)]
18pub struct Message<'a>(pub &'a [u8]);