Skip to main content

sark_core/body/input/
checked.rs

1use sark_http::payload::owned;
2
3use crate::body::{
4    credit,
5    input::{Parts, private},
6};
7
8/// Arbitrary segment input whose dimensions must be checked during transfer.
9pub struct Checked<I>(I);
10
11impl<I> Checked<I> {
12    pub const fn new(input: I) -> Self {
13        Self(input)
14    }
15}
16
17impl<I> private::Private for Checked<I> {}
18
19impl<I: IntoIterator> IntoIterator for Checked<I> {
20    type Item = I::Item;
21    type IntoIter = I::IntoIter;
22
23    fn into_iter(self) -> Self::IntoIter {
24        self.0.into_iter()
25    }
26}
27
28impl<'d, I: IntoIterator<Item = owned::Segment<'d>>> Parts<'d> for Checked<I> {
29    const EXACT: bool = false;
30
31    fn dimensions(&self) -> credit::Amount {
32        credit::Amount::default()
33    }
34}