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§
Required Methods§
Sourcefn id(&self) -> Self::Id
fn id(&self) -> Self::Id
Return the unique identifier for this circuit.
§Requirements
The values returned by this function are unique for distinct circuits.
Sourcefn usable(&self) -> bool
fn usable(&self) -> bool
Return true if this circuit is usable for some purpose.
Reasons a circuit might be unusable include being closed.
Sourcefn path_ref(&self) -> Result<Arc<Path>>
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.
Sourcefn n_hops(&self) -> Result<usize>
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.
Sourcefn is_closing(&self) -> bool
fn is_closing(&self) -> bool
Return true if this circuit 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 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.