fidl_next_bind/
decoded.rs1use fidl_next_codec::{Decoded, FromWire, IntoNatural, Wire};
6use fidl_next_protocol::{Body, Transport};
7
8use crate::HasTransport;
9
10use super::Method;
11
12pub struct Request<M: Method, T: Transport = <<M as Method>::Protocol as HasTransport>::Transport> {
14 decoded: Decoded<M::Request, Body<T>>,
15}
16
17impl<M: Method, T: Transport> Request<M, T> {
18 pub fn from_decoded(decoded: Decoded<M::Request, Body<T>>) -> Self {
20 Self { decoded }
21 }
22
23 pub fn payload(self) -> <M::Request as IntoNatural>::Natural
25 where
26 M::Request:
27 Wire + for<'de> IntoNatural<Natural: FromWire<<M::Request as Wire>::Narrowed<'de>>>,
28 {
29 self.decoded.take()
30 }
31
32 pub fn wire_payload(self) -> Decoded<M::Request, Body<T>> {
34 self.decoded
35 }
36}