fidl/
for_fidl_message_crate.rs1use crate::encoding::{
10 Decode, EmptyPayload, EmptyStruct, Encode, NoHandleResourceDialect, ValueTypeMarker,
11};
12use crate::persistence::Persistable;
13
14pub trait Body:
16 Decode<Self::MarkerAtTopLevel, NoHandleResourceDialect>
17 + Decode<Self::MarkerInResultUnion, NoHandleResourceDialect>
18{
19 type MarkerAtTopLevel: ValueTypeMarker<Owned = Self>
21 + ValueTypeMarker<Owned: Decode<Self::MarkerAtTopLevel, NoHandleResourceDialect>>
22 + for<'a> ValueTypeMarker<
23 Borrowed<'a>: Encode<Self::MarkerAtTopLevel, NoHandleResourceDialect>,
24 >;
25
26 type MarkerInResultUnion: ValueTypeMarker<Owned = Self>
28 + ValueTypeMarker<Owned: Decode<Self::MarkerInResultUnion, NoHandleResourceDialect>>
29 + for<'a> ValueTypeMarker<
30 Borrowed<'a>: Encode<Self::MarkerInResultUnion, NoHandleResourceDialect>,
31 >;
32}
33
34pub trait ErrorType: Decode<Self::Marker, NoHandleResourceDialect> {
36 type Marker: ValueTypeMarker<Owned = Self>;
38}
39
40impl<T: Persistable> Body for T {
41 type MarkerAtTopLevel = Self;
42 type MarkerInResultUnion = Self;
43}
44
45impl Body for () {
46 type MarkerAtTopLevel = EmptyPayload;
47 type MarkerInResultUnion = EmptyStruct;
48}
49
50impl<E: ValueTypeMarker<Owned = E> + Decode<E, NoHandleResourceDialect>> ErrorType for E {
51 type Marker = Self;
52}