Skip to main content

ReplayLogType

Trait ReplayLogType 

Source
pub(crate) trait ReplayLogType {
    type Name;
    type Message;

    const MAGIC: &'static [u8; 32];

    // Required methods
    fn format_filename(name: &Self::Name) -> String;
    fn transform_message(message: &Self::Message) -> [u8; 16];
    fn parse_log_leafname(leaf: &OsStr) -> Result<Self::Name, Cow<'static, str>>;
}
Expand description

A trait to represent a set of types that ReplayLog can be used with.

Required Associated Constants§

Source

const MAGIC: &'static [u8; 32]

A magic string that we put at the start of each log file, to make sure that we don’t confuse this file format with others.

Required Associated Types§

Source

type Name

The name of this item, used for the log filename.

Source

type Message

The type of the messages that we are ensuring the uniqueness of.

Required Methods§

Source

fn format_filename(name: &Self::Name) -> String

Convert Self::Name to a String

Source

fn transform_message(message: &Self::Message) -> [u8; 16]

Convert Self::Message to bytes that will be stored in the log.

Source

fn parse_log_leafname(leaf: &OsStr) -> Result<Self::Name, Cow<'static, str>>

Parse a filename into Self::Name.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl ReplayLogType for IptReplayLogType

Source§

const MAGIC: &'static [u8; 32] = b"<tor hss replay Kangaroo12>\n\0\0\0\0"

Source§

type Name = IptLocalId

Source§

type Message = Introduce2

Source§

impl ReplayLogType for PowNonceReplayLogType

Source§

const MAGIC: &'static [u8; 32] = b"<tor hss pow replay Kangaroo12>\n"

Source§

type Name = Seed

Source§

type Message = Nonce