Skip to main content

AbstractTunnel

Trait AbstractTunnel 

Source
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§

Source

type Id: Clone + Debug + Hash + Eq + Send + Sync

Type for a unique identifier for tunnels.

Required Methods§

Source

fn id(&self) -> Self::Id

Return the unique identifier for this tunnel.

§Requirements

The values returned by this function are unique for distinct tunnels.

Source

fn usable(&self) -> bool

Return true if this tunnel is usable for some purpose.

Reasons a tunnel might be unusable include being closed.

Source

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.

Source

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.

Source

fn is_closing(&self) -> bool

Return true if this tunnel is closed and therefore unusable.

Source

fn unique_id(&self) -> UniqId

Return a process-unique identifier for this tunnel.

Source

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.

Source

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.

Implementations on Foreign Types§

Source§

impl AbstractTunnel for ClientTunnel

Source§

type Id = UniqId

Source§

fn id(&self) -> Self::Id

Source§

fn usable(&self) -> bool

Source§

fn single_path(&self) -> Result<Arc<Path>>

Source§

fn n_hops(&self) -> Result<usize>

Source§

fn is_closing(&self) -> bool

Source§

fn unique_id(&self) -> UniqId

Source§

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,

Source§

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,

Implementors§