Trait MockableCircPool

Source
trait MockableCircPool<R> {
    type ClientCirc: MockableClientCirc;

    // Required methods
    fn m_get_or_launch_specific<'life0, 'life1, 'async_trait>(
        &'life0 self,
        netdir: &'life1 NetDir,
        kind: HsCircKind,
        target: impl 'async_trait + CircTarget + Send + Sync,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<Self::ClientCirc>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn m_get_or_launch_client_rend<'a, 'life0, 'async_trait>(
        &'life0 self,
        netdir: &'a NetDir,
    ) -> Pin<Box<dyn Future<Output = Result<(Arc<Self::ClientCirc>, Relay<'a>)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait;
    fn m_estimate_timeout(&self, action: &TimeoutsAction) -> Duration;
}
Expand description

Mock for HsCircPool

Methods start with m_ to avoid the following problem: ClientCirc::start_conversation (say) means to use the inherent method if one exists, but will use a trait method if there isn’t an inherent method.

So if the inherent method is renamed, the call in the impl here turns into an always-recursive call. This is not detected by the compiler due to the situation being complicated by futures, #[async_trait] etc. https://github.com/rust-lang/rust/issues/111177

Required Associated Types§

Required Methods§

Source

fn m_get_or_launch_specific<'life0, 'life1, 'async_trait>( &'life0 self, netdir: &'life1 NetDir, kind: HsCircKind, target: impl 'async_trait + CircTarget + Send + Sync, ) -> Pin<Box<dyn Future<Output = Result<Arc<Self::ClientCirc>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn m_get_or_launch_client_rend<'a, 'life0, 'async_trait>( &'life0 self, netdir: &'a NetDir, ) -> Pin<Box<dyn Future<Output = Result<(Arc<Self::ClientCirc>, Relay<'a>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Client circuit

Source

fn m_estimate_timeout(&self, action: &TimeoutsAction) -> Duration

Estimate timeout

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.

Implementations on Foreign Types§

Source§

impl<R: Runtime> MockableCircPool<R> for HsCircPool<R>

Source§

type ClientCirc = ClientCirc

Source§

fn m_get_or_launch_specific<'life0, 'life1, 'async_trait>( &'life0 self, netdir: &'life1 NetDir, kind: HsCircKind, target: impl 'async_trait + CircTarget + Send + Sync, ) -> Pin<Box<dyn Future<Output = Result<Arc<ClientCirc>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn m_get_or_launch_client_rend<'a, 'life0, 'async_trait>( &'life0 self, netdir: &'a NetDir, ) -> Pin<Box<dyn Future<Output = Result<(Arc<ClientCirc>, Relay<'a>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Source§

fn m_estimate_timeout(&self, action: &TimeoutsAction) -> Duration

Implementors§