Trait Mockable

Source
pub(crate) trait Mockable<R>:
    Debug
    + Send
    + Sync
    + Sized
    + 'static {
    type IptEstablisher: Send + Sync + 'static;
    type Rng<'m>: Rng + CryptoRng + 'm;

    // Required methods
    fn thread_rng(&mut self) -> Self::Rng<'_>;
    fn make_new_ipt(
        &mut self,
        imm: &Immutable<R>,
        params: IptParameters,
    ) -> Result<(Self::IptEstablisher, Receiver<IptStatus>), FatalError>;
    fn start_accepting(&self, establisher: &(dyn Any + Send + Sync + 'static));
    fn expire_old_ipts_external_persistent_state_hook(&self);
}
Expand description

Mockable state for the IPT Manager

This allows us to use a fake IPT Establisher and IPT Publisher, so that we can unit test the Manager.

Required Associated Types§

Source

type IptEstablisher: Send + Sync + 'static

IPT establisher type

Source

type Rng<'m>: Rng + CryptoRng + 'm

A random number generator

Required Methods§

Source

fn thread_rng(&mut self) -> Self::Rng<'_>

Return a random number generator

Source

fn make_new_ipt( &mut self, imm: &Immutable<R>, params: IptParameters, ) -> Result<(Self::IptEstablisher, Receiver<IptStatus>), FatalError>

Call IptEstablisher::new

Source

fn start_accepting(&self, establisher: &(dyn Any + Send + Sync + 'static))

Call IptEstablisher::start_accepting

Source

fn expire_old_ipts_external_persistent_state_hook(&self)

Allow tests to see when IptManager::expire_old_ipts_external_persistent_state is called.

This lets tests see that it gets called at the right times, and not the wrong ones.

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§