Skip to main content

vox_core/
into_conduit.rs

1use vox_types::{Link, MsgFamily};
2
3use crate::BareConduit;
4
5/// Converts a value into a [`vox_types::Conduit`].
6///
7/// Implemented for:
8/// - [`BareConduit`] → identity (pass-through)
9///
10/// This allows [`crate::Session`] connection handling methods to accept
11/// already-constructed conduits without additional wrapping.
12pub trait IntoConduit {
13    /// The conduit type produced by this conversion.
14    type Conduit;
15
16    /// Convert into a conduit.
17    fn into_conduit(self) -> Self::Conduit;
18}
19
20/// [`BareConduit`] passes through unchanged.
21impl<F: MsgFamily, L: Link> IntoConduit for BareConduit<F, L> {
22    type Conduit = BareConduit<F, L>;
23
24    fn into_conduit(self) -> Self::Conduit {
25        self
26    }
27}