wasmflow_boundary/
incoming.rs1#[derive(Debug)]
3pub struct IncomingPayload<P, C>
4where
5 P: std::fmt::Debug,
6 C: std::fmt::Debug,
7{
8 id: u32,
9 payload: P,
10 config: Option<C>,
11}
12
13impl<P, C> IncomingPayload<P, C>
14where
15 P: std::fmt::Debug + serde::de::DeserializeOwned,
16 C: std::fmt::Debug + serde::de::DeserializeOwned,
17{
18 pub fn new(id: u32, payload: P, config: Option<C>) -> Self {
20 Self { id, payload, config }
21 }
22
23 #[must_use]
25 pub fn id(&self) -> u32 {
26 self.id
27 }
28
29 #[must_use]
31 pub fn payload(&self) -> &P {
32 &self.payload
33 }
34
35 #[must_use]
37 pub fn config(&self) -> &Option<C> {
38 &self.config
39 }
40
41 #[must_use]
43 pub fn into_parts(self) -> (P, Option<C>) {
44 (self.payload, self.config)
45 }
46}