pub struct Flow { /* private fields */ }Expand description
The sending half of one datagram flow.
Flow::send never waits: it hands the datagram to the connection and
returns. Dropping the flow closes it with FIN, which the receiver sees as
the end of the flow; Flow::abort resets it instead.
A flow opened through a dialling crate::Peer belongs to the address,
not to the connection: when the connection is lost it is registered again
on the redialled one, under a new id, and every datagram sent while no
connection is live is dropped and counted as not_live — never queued,
because a queued unit is a late one
(decisions/0034 §4.10).
Implementations§
Source§impl Flow
impl Flow
Sourcepub fn send(&self, payload: impl Into<Bytes>) -> Result<(), Error>
pub fn send(&self, payload: impl Into<Bytes>) -> Result<(), Error>
Sends one datagram. Never waits.
Ok means the datagram was handed to the connection, not that it
arrived: a flow is BestEffort per datagram. Errors:
Error::TooLargewhenpayloadexceedsFlow::max_payload;Error::DatagramsUnavailablewhen the connection carries no datagrams at all;- on a flow that has ended, the error that ended it — the receiver’s
refusal (
Error::Rejected,Error::UnknownEndpoint,Error::Unsupported,Error::LimitExceeded), its release (Error::Canceled), orError::ConnectionLost.
Sourcepub fn max_payload(&self) -> Option<usize>
pub fn max_payload(&self) -> Option<usize>
The largest payload Flow::send accepts right now: the
connection’s current datagram size minus the flow id’s prefix on QUIC,
LOCAL_MAX_DATAGRAM on a local transport. None when the
connection carries no datagrams.
Sourcepub fn path_stats(&self) -> Option<PathStats>
pub fn path_stats(&self) -> Option<PathStats>
The path under this flow, or None on a local transport, which has
no path to measure.