Trait tor_dirmgr::bridgedesc::mockable::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§
Required Methods§
sourcefn 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,
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.
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl<R: Runtime> MockableAPI<R> for ()
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,
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