xwt_core/
lib.rs

1//! A common WebTransport interface for browser and native.
2//! Write once, run anywhere.
3//!
4//! Users should utilise the traits from this crate directly for the most
5//! flexibility at the type level.
6
7#![no_std]
8
9#[cfg(feature = "std")]
10extern crate std;
11
12#[cfg(feature = "alloc")]
13extern crate alloc;
14
15pub mod base;
16pub mod endpoint;
17pub mod session;
18pub mod stream;
19pub mod stream_utils;
20
21pub mod utils {
22    //! Useful utilities.
23
24    pub mod dummy;
25    pub mod maybe;
26
27    pub use core::error::Error;
28}
29
30pub mod prelude {
31    //! A prelude of the ferquently used types.
32
33    pub use crate::base::Session as _;
34    pub use crate::endpoint::accept::{Accept as _, Accepting as _, Request as _};
35    pub use crate::endpoint::connect::{Connect as _, Connecting as _};
36    pub use crate::session::base::{DatagramOps as _, StreamOps as _};
37    pub use crate::session::datagram::{MaxSize as _, Receive as _, ReceiveInto as _, Send as _};
38    pub use crate::session::stream::{
39        AcceptBi as _, AcceptUni as _, OpenBi as _, OpenUni as _, OpeningBi as _, OpeningUni as _,
40    };
41    pub use crate::stream::{
42        ErrorAsErrorCode as _, Finish as _, Finished as _, Read as _, ReadAbort as _,
43        ReadAborted as _, ReadChunk as _, Write as _, WriteAbort as _, WriteAborted as _,
44        WriteChunk as _,
45    };
46
47    pub use crate::endpoint::accept_utils::*;
48    pub use crate::endpoint::connect_utils::*;
49    pub use crate::session::datagram_utils::*;
50    pub use crate::session::stream_utils::*;
51    pub use crate::stream_utils::*;
52}
53
54/// An backward-compat [`Connection`] trait.
55#[deprecated = "use base::Session instead"]
56pub trait Connection: base::Session {}
57
58#[allow(deprecated)]
59impl<T> Connection for T where T: base::Session {}