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§
Sourcetype IptEstablisher: Send + Sync + 'static
type IptEstablisher: Send + Sync + 'static
IPT establisher type
Required Methods§
Sourcefn thread_rng(&mut self) -> Self::Rng<'_>
fn thread_rng(&mut self) -> Self::Rng<'_>
Return a random number generator
Sourcefn make_new_ipt(
&mut self,
imm: &Immutable<R>,
params: IptParameters,
) -> Result<(Self::IptEstablisher, Receiver<IptStatus>), FatalError>
fn make_new_ipt( &mut self, imm: &Immutable<R>, params: IptParameters, ) -> Result<(Self::IptEstablisher, Receiver<IptStatus>), FatalError>
Call IptEstablisher::new
Sourcefn start_accepting(&self, establisher: &(dyn Any + Send + Sync + 'static))
fn start_accepting(&self, establisher: &(dyn Any + Send + Sync + 'static))
Call IptEstablisher::start_accepting
Sourcefn expire_old_ipts_external_persistent_state_hook(&self)
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.