pub(crate) trait AbstractTunnel: Debug {
type Id: Clone + Debug + Hash + Eq + Send + Sync;
// Required methods
fn id(&self) -> Self::Id;
fn usable(&self) -> bool;
fn single_path(&self) -> Result<Arc<Path>>;
fn n_hops(&self) -> Result<usize>;
fn is_closing(&self) -> bool;
fn unique_id(&self) -> UniqId;
fn extend<'life0, 'life1, 'async_trait, T>(
&'life0 self,
target: &'life1 T,
params: CircParameters,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where T: 'async_trait + CircTarget + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn last_known_to_be_used_at<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Instant>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Minimal abstract view of a tunnel.
From this module’s point of view, tunnels are simply objects with unique identities, and a possible closed-state.
Required Associated Types§
Required Methods§
Sourcefn id(&self) -> Self::Id
fn id(&self) -> Self::Id
Return the unique identifier for this tunnel.
§Requirements
The values returned by this function are unique for distinct tunnels.
Sourcefn usable(&self) -> bool
fn usable(&self) -> bool
Return true if this tunnel is usable for some purpose.
Reasons a tunnel might be unusable include being closed.
Sourcefn single_path(&self) -> Result<Arc<Path>>
fn single_path(&self) -> Result<Arc<Path>>
Return a list of Path objects describing the only circuit in this tunnel.
Returns an error if the tunnel has more than one tunnel.
Sourcefn n_hops(&self) -> Result<usize>
fn n_hops(&self) -> Result<usize>
Return the number of hops in this tunnel.
Returns an error if the circuit is closed.
NOTE: This function will currently return only the number of hops currently in the tunnel. If there is an extend operation in progress, the currently pending hop may or may not be counted, depending on whether the extend operation finishes before this call is done.
Sourcefn is_closing(&self) -> bool
fn is_closing(&self) -> bool
Return true if this tunnel is closed and therefore unusable.
Sourcefn extend<'life0, 'life1, 'async_trait, T>(
&'life0 self,
target: &'life1 T,
params: CircParameters,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
T: 'async_trait + CircTarget + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn extend<'life0, 'life1, 'async_trait, T>(
&'life0 self,
target: &'life1 T,
params: CircParameters,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
T: 'async_trait + CircTarget + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Extend the tunnel via the most appropriate handshake to a new target hop.
Sourcefn last_known_to_be_used_at<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Instant>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn last_known_to_be_used_at<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Instant>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return a time at which this tunnel is last known to be used, or None if it is in use right now (or has never been used).
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.