blob: 4a4f42169a64dd254eab4de1ff30cbfa505433b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
//! Module exposing channel message-related utilities.
use tor_cell::chancell::msg::Relay;
use either::Either;
/// A trait implemented by subclasses of `ChanMsg`
/// that support [`Relay`] messages.
///
// TODO(relay): this trait is an implementation detail of the new circuit reactor.
// It should not be implemented for other message types, nor exposed
// outside of tor-proto.
//
// We might decide to remove this in a future iteration of the circuit reactor,
// if we find a different way of doing implementation-agnostic RELAY message handling.
pub(crate) trait ToRelayMsg {
/// Try to return this message type as a [`Relay`].
///
/// Returns `Left` if this is a [`Relay`] message,
/// or a `Right` containing the unmodified `self` otherwise.
fn to_relay_msg(self) -> Either<Relay, Self>
where
Self: Sized;
}
|