diff options
Diffstat (limited to 'msg_socket2/src/ser.rs')
-rw-r--r-- | msg_socket2/src/ser.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/msg_socket2/src/ser.rs b/msg_socket2/src/ser.rs index 8be85aa..78ea1e6 100644 --- a/msg_socket2/src/ser.rs +++ b/msg_socket2/src/ser.rs @@ -353,6 +353,16 @@ pub trait FdSerializer<'fds>: Sized { variant: &'static str, ) -> Result<Self::Ok, Self::Error>; + /// Like `Serializer::serialize_newtype_variant`, but `value` is a + /// `SerializeWithFds` instead of a `Serialize`. + fn serialize_newtype_variant<T: SerializeWithFds + ?Sized>( + self, + name: &'static str, + variant_index: u32, + variant: &'static str, + value: &'fds T, + ) -> Result<Self::Ok, Self::Error>; + /// Like `Serializer::serialize_seq`, but returns a /// `SerializeSeqFds`, which serializes file descriptors as well /// as data. @@ -448,6 +458,16 @@ impl<'ser, 'fds: 'ser> FdSerializer<'fds> for &'ser mut FdSerializerImpl<'fds> { Ok(()) } + fn serialize_newtype_variant<T: SerializeWithFds + ?Sized>( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + value: &'fds T, + ) -> Result<Self::Ok, Self::Error> { + value.serialize_fds(self) + } + fn serialize_seq(self, _len: Option<usize>) -> Result<Self::SerializeSeqFds, Self::Error> { Ok(Composite { serializer: self }) } |