Trait AbstractCirc

Source
pub(crate) trait AbstractCirc: Debug {
    type Id: Clone + Debug + Hash + Eq + Send + Sync;

    // Required methods
    fn id(&self) -> Self::Id;
    fn usable(&self) -> bool;
    fn path_ref(&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;
}
Expand description

Minimal abstract view of a circuit.

From this module’s point of view, circuits 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 circuits.

Required Methods§

Source

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

Return the unique identifier for this circuit.

§Requirements

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

Source

fn usable(&self) -> bool

Return true if this circuit is usable for some purpose.

Reasons a circuit might be unusable include being closed.

Source

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

Return a [Path] object describing all the hops in this circuit.

Returns an error if the circuit is closed.

Note that this Path is not automatically updated if the circuit is extended.

Source

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

Return the number of hops in this circuit.

Returns an error if the circuit is closed.

NOTE: This function will currently return only the number of hops currently in the circuit. 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 circuit is closed and therefore unusable.

Source

fn unique_id(&self) -> UniqId

Return a process-unique identifier for this circuit.

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 circuit via the most appropriate handshake to a new target hop.

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 AbstractCirc for ClientCirc

Source§

type Id = UniqId

Source§

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

Source§

fn usable(&self) -> bool

Source§

fn path_ref(&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,

Implementors§