Skip to main content

trillium_http/
h3.rs

1//! Trillium HTTP/3 types
2
3// Retained only so an older `trillium-client` that predates `Body::write_into` still builds
4// against this crate; remove it at the next breaking release.
5#[cfg(feature = "unstable")]
6mod body_wrapper;
7mod connection;
8mod error;
9mod frame;
10#[cfg(feature = "unstable")]
11pub mod quic_varint;
12#[cfg(not(feature = "unstable"))]
13pub(crate) mod quic_varint;
14mod settings;
15
16#[cfg(all(test, feature = "unstable"))]
17mod tests;
18
19/// An error that may occur during HTTP/3 stream or connection processing.
20///
21/// When the error is `Protocol`, the contained [`H3ErrorCode`] should be communicated to the
22/// peer via the QUIC connection's error signaling. `Io` errors indicate an unrecoverable
23/// transport failure.
24#[derive(thiserror::Error, Debug)]
25#[non_exhaustive]
26pub enum H3Error {
27    #[error(transparent)]
28    /// An HTTP/3 protocol error; the error code should be signaled to the peer.
29    Protocol(#[from] H3ErrorCode),
30
31    #[error(transparent)]
32    /// An unrecoverable I/O error encountered at the network layer.
33    Io(#[from] std::io::Error),
34}
35
36#[cfg(feature = "unstable")]
37pub use body_wrapper::H3Body;
38pub use connection::{H3BidiRequest, H3Connection, H3StreamResult, UniStreamResult};
39pub use error::H3ErrorCode;
40pub(crate) use frame::UniStreamType;
41#[cfg(feature = "unstable")]
42pub use frame::{ActiveFrame, Frame, FrameDecodeError, FrameStream};
43#[cfg(not(feature = "unstable"))]
44pub(crate) use frame::{Frame, FrameDecodeError, FrameStream};
45pub(crate) use settings::H3Settings;
46
47pub(crate) const MAX_BUFFER_SIZE: usize = 1024 * 10;