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
7pub trait SocketControlMessageExtManual: IsA<SocketControlMessage> + Sized {
8    /// Converts the data in the message to bytes placed in the
9    /// message.
10    ///
11    /// @data is guaranteed to have enough space to fit the size
12    /// returned by g_socket_control_message_get_size() on this
13    /// object.
14    #[doc(alias = "g_socket_control_message_serialize")]
15    fn serialize(&self, data: &mut [u8]) {
16        assert!(data.len() >= self.size());
17        unsafe {
18            crate::ffi::g_socket_control_message_serialize(
19                self.as_ref().to_glib_none().0,
20                data.as_mut_ptr() as *mut _,
21            );
22        }
23    }
24}
25
26impl<O: IsA<SocketControlMessage>> SocketControlMessageExtManual for O {}