nyquest_interface/blocking/
body.rs

1//! Blocking body types for HTTP requests.
2//!
3//! This module defines types for handling blocking request bodies.
4
5use std::io::{Read, Seek};
6
7/// Trait for blocking body streams.
8#[doc(hidden)]
9pub trait BodyStream: Read + Seek + Send {}
10
11/// Type alias for boxed blocking body streams.
12#[doc(hidden)]
13pub type BoxedStream = Box<dyn BodyStream>;
14
15/// Type alias for blocking HTTP request bodies.
16pub type Body = crate::body::Body<BoxedStream>;
17
18impl Body {
19    /// Creates a new streaming body from a reader.
20    #[doc(hidden)]
21    pub fn stream<S: Read + Seek + Send + 'static>(stream: S, content_length: Option<u64>) -> Self {
22        crate::body::Body::Stream(crate::body::StreamReader {
23            stream: Box::new(stream),
24            content_length,
25        })
26    }
27}
28
29impl<S: Read + Seek + Send + ?Sized> BodyStream for S {}