From aa9ee49fdf908aef32d4363704099a0584834d4c Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Fri, 10 Apr 2020 13:04:17 +0000 Subject: msg_socket2: add serialize_newtype_variant --- msg_socket2/src/ser.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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; + /// Like `Serializer::serialize_newtype_variant`, but `value` is a + /// `SerializeWithFds` instead of a `Serialize`. + fn serialize_newtype_variant( + self, + name: &'static str, + variant_index: u32, + variant: &'static str, + value: &'fds T, + ) -> Result; + /// 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( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + value: &'fds T, + ) -> Result { + value.serialize_fds(self) + } + fn serialize_seq(self, _len: Option) -> Result { Ok(Composite { serializer: self }) } -- cgit 1.4.1