Skip to main content

sark_core/decode/request/
project.rs

1use sark_http::request::body::Error;
2
3use crate::decode::request::Ready;
4
5#[must_use]
6#[derive(Debug)]
7pub struct Project<K, P, S> {
8    error: Error,
9    ready: Ready<K, P, S>,
10}
11
12impl<K, P, S> Project<K, P, S> {
13    pub(in crate::decode) const fn new(error: Error, ready: Ready<K, P, S>) -> Self {
14        Self { error, ready }
15    }
16
17    pub const fn error(&self) -> Error {
18        self.error
19    }
20
21    /// Ends the rejected request owner and returns the projection failure.
22    pub fn discard(self) -> Error {
23        drop(self.ready);
24        self.error
25    }
26}