xwt_core/session/
base.rs

1//! The base WebTransport session operations definition.
2
3use crate::utils::maybe;
4
5use super::{datagram, stream};
6
7/// Base stream operations.
8///
9/// A blanket implementation for all the types that implement
10/// the required base stream APIs.
11///
12/// You might want to depend on this trait instead of the more
13/// demaning [`crate::base::Session`] in your libraries that only require
14/// stream operations.
15///
16/// Also, consider depending on the individual stream APIs directly.
17pub trait StreamOps:
18    stream::PairSpec + stream::OpenBi + stream::OpenUni + stream::AcceptBi + stream::AcceptUni
19{
20}
21
22impl<T> StreamOps for T where
23    T: stream::PairSpec + stream::OpenBi + stream::OpenUni + stream::AcceptBi + stream::AcceptUni
24{
25}
26
27/// Base datagram operations.
28///
29/// A blanket implementation for all the types that implement
30/// the required base datagram APIs.
31///
32/// You might want to depend on this trait instead of the more
33/// demaning [`crate::base::Session`] in your libraries that only require
34/// stream operations.
35///
36/// Also, consider depending on the individual datagram APIs directly.
37pub trait DatagramOps:
38    maybe::Send + datagram::MaxSize + datagram::Send + datagram::Receive + datagram::ReceiveInto
39{
40}
41
42impl<T> DatagramOps for T where
43    T: maybe::Send + datagram::MaxSize + datagram::Send + datagram::Receive + datagram::ReceiveInto
44{
45}