Trait MockableAPI

Source
pub trait MockableAPI<R>:
    Clone
    + Send
    + Sync
    + 'static {
    type CircMgr: Send + Sync + 'static;

    // Required method
    fn download<'life0, 'life1, 'life2, 'async_trait>(
        self,
        runtime: &'life0 R,
        circmgr: &'life1 Self::CircMgr,
        bridge: &'life2 BridgeConfig,
        if_modified_since: Option<SystemTime>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Available on crate feature bridge-client only.
Expand description

Defines the actual mockable APIs

Not nameable (and therefore not implementable) outside the bridgedesc module,

Required Associated Types§

Source

type CircMgr: Send + Sync + 'static

Circuit manager

Required Methods§

Source

fn download<'life0, 'life1, 'life2, 'async_trait>( self, runtime: &'life0 R, circmgr: &'life1 Self::CircMgr, bridge: &'life2 BridgeConfig, if_modified_since: Option<SystemTime>, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Download this bridge’s descriptor, and return it as a string

Runs in a task. Called by Manager::download_descriptor, which handles parsing and validation.

If if_modified_since is Some, should tolerate an HTTP 304 Not Modified and return None in that case. If if_modified_since is None, returning Ok(None,) is forbidden.

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> MockableAPI<R> for ()

Source§

fn download<'life0, 'life1, 'life2, 'async_trait>( self, runtime: &'life0 R, circmgr: &'life1 Self::CircMgr, bridge: &'life2 BridgeConfig, _if_modified_since: Option<SystemTime>, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Actual code for downloading a descriptor document

Source§

type CircMgr = Arc<CircMgr<R>>

Implementors§