gio/
socket_control_message.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::{prelude::*, translate::*};
4
5use crate::{prelude::*, SocketControlMessage};
6
7mod sealed {
8    pub trait Sealed {}
9    impl<T: super::IsA<super::SocketControlMessage>> Sealed for T {}
10}
11
12pub trait SocketControlMessageExtManual:
13    sealed::Sealed + IsA<SocketControlMessage> + Sized
14{
15    /// Converts the data in the message to bytes placed in the
16    /// message.
17    ///
18    /// @data is guaranteed to have enough space to fit the size
19    /// returned by g_socket_control_message_get_size() on this
20    /// object.
21    #[doc(alias = "g_socket_control_message_serialize")]
22    fn serialize(&self, data: &mut [u8]) {
23        assert!(data.len() >= self.size());
24        unsafe {
25            crate::ffi::g_socket_control_message_serialize(
26                self.as_ref().to_glib_none().0,
27                data.as_mut_ptr() as *mut _,
28            );
29        }
30    }
31}
32
33impl<O: IsA<SocketControlMessage>> SocketControlMessageExtManual for O {}