fidl_next_bind/
decoded.rs1use fidl_next_codec::{Decoded, FromWire, IntoNatural, Wire};
6use fidl_next_protocol::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, T::RecvBuffer>,
15}
16
17impl<M: Method, T: Transport> Request<M, T> {
18 pub fn from_decoded(decoded: Decoded<M::Request, T::RecvBuffer>) -> Self {
20 Self { decoded }
21 }
22
23 pub fn payload(self) -> <M::Request as IntoNatural>::Natural
25 where
26 M::Request: Wire + IntoNatural,
27 <M::Request as IntoNatural>::Natural: for<'de> FromWire<<M::Request as Wire>::Owned<'de>>,
28 {
29 self.decoded.take()
30 }
31
32 pub fn wire_payload(self) -> Decoded<M::Request, T::RecvBuffer> {
34 self.decoded
35 }
36}