pub struct SessionBuilder<P: Protocol, Cs, Lm, Rm, Pe> { /* private fields */ }Expand description
Typestate builder for Session<P, Configured>.
Parameters:
P— protocol marker (super::DPlus,super::DExtra,super::Dcs)Cs—MissingorProvided, tracks whether the callsign has been setLm— tracks local moduleRm— tracks reflector modulePe— tracks peer address
All four Missing/Provided type parameters start as
Missing and must be flipped to Provided before
Self::build becomes callable. The phantoms add zero runtime
cost.
Implementations§
Source§impl<P: Protocol, Cs, Lm, Rm, Pe> SessionBuilder<P, Cs, Lm, Rm, Pe>
impl<P: Protocol, Cs, Lm, Rm, Pe> SessionBuilder<P, Cs, Lm, Rm, Pe>
Sourcepub const fn callsign(
self,
callsign: Callsign,
) -> SessionBuilder<P, Provided, Lm, Rm, Pe>
pub const fn callsign( self, callsign: Callsign, ) -> SessionBuilder<P, Provided, Lm, Rm, Pe>
Set the station callsign.
Sourcepub const fn local_module(
self,
module: Module,
) -> SessionBuilder<P, Cs, Provided, Rm, Pe>
pub const fn local_module( self, module: Module, ) -> SessionBuilder<P, Cs, Provided, Rm, Pe>
Set the local module letter (the module on the client side).
Sourcepub const fn reflector_module(
self,
module: Module,
) -> SessionBuilder<P, Cs, Lm, Provided, Pe>
pub const fn reflector_module( self, module: Module, ) -> SessionBuilder<P, Cs, Lm, Provided, Pe>
Set the reflector module letter (the module we want to link to).
Sourcepub const fn peer(
self,
peer: SocketAddr,
) -> SessionBuilder<P, Cs, Lm, Rm, Provided>
pub const fn peer( self, peer: SocketAddr, ) -> SessionBuilder<P, Cs, Lm, Rm, Provided>
Set the reflector peer address.
Sourcepub const fn reflector_callsign(self, reflector_callsign: Callsign) -> Self
pub const fn reflector_callsign(self, reflector_callsign: Callsign) -> Self
Set the target reflector’s own callsign.
Required for DCS sessions targeting any reflector other
than DCS001. The DCS wire format embeds the reflector
callsign in every LINK / UNLINK / POLL packet, and a real
DCS030 reflector will silently drop traffic whose embedded
reflector callsign reads DCS001 . For DPlus and
DExtra this is metadata only — the protocols do not carry
the reflector callsign on the wire, so the setter is
harmless when unused.
Unlike the four required fields, this setter does not flip
a typestate marker — sessions that do not need a reflector
callsign keep building with four setters, and DCS sessions
that forget it get a runtime warning at construction time
plus a DCS001 fallback. Upgrading this to a compile-time
requirement for Session<Dcs, _> specifically is a future
design refinement.
Source§impl<P: Protocol> SessionBuilder<P, Provided, Provided, Provided, Provided>
impl<P: Protocol> SessionBuilder<P, Provided, Provided, Provided, Provided>
Sourcepub fn build(self) -> Session<P, Configured>
pub fn build(self) -> Session<P, Configured>
Build the Session<P, Configured>.
Only callable when all four required fields have been set —
any Missing marker turns this into a compile error.
The Provided type parameters are the typestate proof that
every field was set; the Option unwrapping below is
therefore infallible at the type level, and we use
unreachable! in the impossible branches rather than
Option::expect (which is lint-denied in lib code).