pub struct Socket { /* private fields */ }
Expand description
A GSocket
is a low-level networking primitive. It is a more or less
direct mapping of the BSD socket API in a portable GObject based API.
It supports both the UNIX socket implementations and winsock2 on Windows.
GSocket
is the platform independent base upon which the higher level
network primitives are based. Applications are not typically meant to
use it directly, but rather through classes like SocketClient
,
SocketService
and SocketConnection
. However there may
be cases where direct use of GSocket
is useful.
GSocket
implements the Initable
interface, so if it is manually
constructed by e.g. glib::Object::new()
you must call
InitableExt::init()
and check the results before using the object.
This is done automatically in new()
and
from_fd()
, so these functions can return NULL
.
Sockets operate in two general modes, blocking or non-blocking. When
in blocking mode all operations (which don’t take an explicit blocking
parameter) block until the requested operation
is finished or there is an error. In non-blocking mode all calls that
would block return immediately with a G_IO_ERROR_WOULD_BLOCK
error.
To know when a call would successfully run you can call
SocketExt::condition_check()
, or SocketExt::condition_wait()
.
You can also use Gio::Socket::create_source()
and attach it to a
[type@GLib.MainContext] to get callbacks when I/O is possible.
Note that all sockets are always set to non blocking mode in the system, and
blocking mode is emulated in GSocket
.
When working in non-blocking mode applications should always be able to
handle getting a G_IO_ERROR_WOULD_BLOCK
error even when some other
function said that I/O was possible. This can easily happen in case
of a race condition in the application, but it can also happen for other
reasons. For instance, on Windows a socket is always seen as writable
until a write returns G_IO_ERROR_WOULD_BLOCK
.
GSocket
s can be either connection oriented or datagram based.
For connection oriented types you must first establish a connection by
either connecting to an address or accepting a connection from another
address. For connectionless socket types the target/source address is
specified or received in each I/O operation.
All socket file descriptors are set to be close-on-exec.
Note that creating a GSocket
causes the signal SIGPIPE
to be
ignored for the remainder of the program. If you are writing a
command-line utility that uses GSocket
, you may need to take into
account the fact that your program will not automatically be killed
if it tries to write to stdout
after it has been closed.
Like most other APIs in GLib, GSocket
is not inherently thread safe. To use
a GSocket
concurrently from multiple threads, you must implement your own
locking.
§Nagle’s algorithm
Since GLib 2.80, GSocket
will automatically set the TCP_NODELAY
option on
all G_SOCKET_TYPE_STREAM
sockets. This disables
Nagle’s algorithm as it
typically does more harm than good on modern networks.
If your application needs Nagle’s algorithm enabled, call
SocketExt::set_option()
after constructing a GSocket
to enable it:
⚠️ The following code is in c ⚠️
socket = g_socket_new (…, G_SOCKET_TYPE_STREAM, …);
if (socket != NULL)
{
g_socket_set_option (socket, IPPROTO_TCP, TCP_NODELAY, FALSE, &local_error);
// handle error if needed
}
§Properties
§blocking
Whether I/O on this socket is blocking.
Readable | Writeable
§broadcast
Whether the socket should allow sending to broadcast addresses.
Readable | Writeable
§family
The socket’s address family.
Readable | Writeable | Construct Only
§fd
The socket’s file descriptor.
Readable | Writeable | Construct Only
§keepalive
Whether to keep the connection alive by sending periodic pings.
Readable | Writeable
§listen-backlog
The number of outstanding connections in the listen queue.
Readable | Writeable
§local-address
The local address the socket is bound to.
Readable
§multicast-loopback
Whether outgoing multicast packets loop back to the local host.
Readable | Writeable
§multicast-ttl
Time-to-live out outgoing multicast packets
Readable | Writeable
§protocol
The ID of the protocol to use, or -1
for unknown.
Readable | Writeable | Construct Only
§remote-address
The remote address the socket is connected to.
Readable
§timeout
The timeout in seconds on socket I/O
Readable | Writeable
§ttl
Time-to-live for outgoing unicast packets
Readable | Writeable
§type
The socket’s type.
Readable | Writeable | Construct Only
§Implements
SocketExt
, [trait@glib::ObjectExt
], DatagramBasedExt
, InitableExt
, SocketExtManual
, DatagramBasedExtManual
GLib type: GObject with reference counted clone semantics.
Implementations§
Source§impl Socket
impl Socket
Sourcepub unsafe fn from_fd(fd: impl IntoRawFd) -> Result<Socket, Error>
Available on Unix only.
pub unsafe fn from_fd(fd: impl IntoRawFd) -> Result<Socket, Error>
Creates a new #GSocket from a native file descriptor or winsock SOCKET handle.
This reads all the settings from the file descriptor so that all properties should work. Note that the file descriptor will be set to non-blocking mode, independent on the blocking mode of the #GSocket.
On success, the returned #GSocket takes ownership of @fd. On failure, the caller must close @fd themselves.
Since GLib 2.46, it is no longer a fatal error to call this on a non-socket
descriptor. Instead, a GError will be set with code IOErrorEnum::Failed
§fd
a native socket file descriptor.
§Returns
a #GSocket or None
on error.
Free the returned object with g_object_unref().
Source§impl Socket
impl Socket
pub const NONE: Option<&'static Socket> = None
Sourcepub fn new(
family: SocketFamily,
type_: SocketType,
protocol: SocketProtocol,
) -> Result<Socket, Error>
pub fn new( family: SocketFamily, type_: SocketType, protocol: SocketProtocol, ) -> Result<Socket, Error>
Creates a new #GSocket with the defined family, type and protocol.
If @protocol is 0 (SocketProtocol::Default
) the default protocol type
for the family and type is used.
The @protocol is a family and type specific int that specifies what kind of protocol to use. #GSocketProtocol lists several common ones. Many families only support one protocol, and use 0 for this, others support several and using 0 means to use the default protocol for the family and type.
The protocol id is passed directly to the operating system, so you can use protocols not listed in #GSocketProtocol if you know the protocol number used for it.
§family
the socket family to use, e.g. SocketFamily::Ipv4
.
§type_
the socket type to use.
§protocol
the id of the protocol to use, or 0 for default.
§Returns
a #GSocket or None
on error.
Free the returned object with g_object_unref().
Trait Implementations§
Source§impl HasParamSpec for Socket
impl HasParamSpec for Socket
Source§impl Ord for Socket
impl Ord for Socket
Source§fn cmp(&self, other: &Self) -> Ordering
fn cmp(&self, other: &Self) -> Ordering
Comparison for two GObjects.
Compares the memory addresses of the provided objects.
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<OT: ObjectType> PartialEq<OT> for Socket
impl<OT: ObjectType> PartialEq<OT> for Socket
Source§impl<OT: ObjectType> PartialOrd<OT> for Socket
impl<OT: ObjectType> PartialOrd<OT> for Socket
Source§impl StaticType for Socket
impl StaticType for Socket
Source§fn static_type() -> Type
fn static_type() -> Type
Self
.impl Eq for Socket
impl IsA<DatagramBased> for Socket
impl IsA<Initable> for Socket
Auto Trait Implementations§
impl Freeze for Socket
impl RefUnwindSafe for Socket
impl !Send for Socket
impl !Sync for Socket
impl Unpin for Socket
impl UnwindSafe for Socket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Cast for Twhere
T: ObjectType,
impl<T> Cast for Twhere
T: ObjectType,
Source§fn upcast<T>(self) -> Twhere
T: ObjectType,
Self: IsA<T>,
fn upcast<T>(self) -> Twhere
T: ObjectType,
Self: IsA<T>,
T
. Read moreSource§fn upcast_ref<T>(&self) -> &Twhere
T: ObjectType,
Self: IsA<T>,
fn upcast_ref<T>(&self) -> &Twhere
T: ObjectType,
Self: IsA<T>,
T
. Read moreSource§fn downcast<T>(self) -> Result<T, Self>where
T: ObjectType,
Self: MayDowncastTo<T>,
fn downcast<T>(self) -> Result<T, Self>where
T: ObjectType,
Self: MayDowncastTo<T>,
T
. Read moreSource§fn downcast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
Self: MayDowncastTo<T>,
fn downcast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
Self: MayDowncastTo<T>,
T
. Read moreSource§fn dynamic_cast<T>(self) -> Result<T, Self>where
T: ObjectType,
fn dynamic_cast<T>(self) -> Result<T, Self>where
T: ObjectType,
T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while upcast
will do many checks at compile-time already. downcast
will
perform the same checks at runtime as dynamic_cast
, but will also ensure some amount of
compile-time safety. Read moreSource§fn dynamic_cast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
fn dynamic_cast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read moreSource§unsafe fn unsafe_cast<T>(self) -> Twhere
T: ObjectType,
unsafe fn unsafe_cast<T>(self) -> Twhere
T: ObjectType,
T
unconditionally. Read moreSource§unsafe fn unsafe_cast_ref<T>(&self) -> &Twhere
T: ObjectType,
unsafe fn unsafe_cast_ref<T>(&self) -> &Twhere
T: ObjectType,
&T
unconditionally. Read moreSource§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<O> DatagramBasedExt for Owhere
O: IsA<DatagramBased>,
impl<O> DatagramBasedExt for Owhere
O: IsA<DatagramBased>,
Source§fn condition_check(&self, condition: IOCondition) -> IOCondition
fn condition_check(&self, condition: IOCondition) -> IOCondition
Source§impl<O> DatagramBasedExtManual for Owhere
O: IsA<DatagramBased>,
impl<O> DatagramBasedExtManual for Owhere
O: IsA<DatagramBased>,
Source§fn create_source<F, C>(
&self,
condition: IOCondition,
cancellable: Option<&C>,
name: Option<&str>,
priority: Priority,
func: F,
) -> Source
fn create_source<F, C>( &self, condition: IOCondition, cancellable: Option<&C>, name: Option<&str>, priority: Priority, func: F, ) -> Source
fn create_source_future<C: IsA<Cancellable>>( &self, condition: IOCondition, cancellable: Option<&C>, priority: Priority, ) -> Pin<Box<dyn Future<Output = IOCondition> + 'static>>
fn create_source_stream<C: IsA<Cancellable>>( &self, condition: IOCondition, cancellable: Option<&C>, priority: Priority, ) -> Pin<Box<dyn Stream<Item = IOCondition> + 'static>>
Source§fn condition_wait(
&self,
condition: IOCondition,
timeout: Option<Duration>,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<(), Error>
fn condition_wait( &self, condition: IOCondition, timeout: Option<Duration>, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>
Source§fn receive_messages<'v, V: IntoIterator<Item = &'v mut [&'v mut [u8]]>, C: IsA<Cancellable>>(
&self,
messages: &mut [InputMessage<'_>],
flags: i32,
timeout: Option<Duration>,
cancellable: Option<&C>,
) -> Result<usize, Error>
fn receive_messages<'v, V: IntoIterator<Item = &'v mut [&'v mut [u8]]>, C: IsA<Cancellable>>( &self, messages: &mut [InputMessage<'_>], flags: i32, timeout: Option<Duration>, cancellable: Option<&C>, ) -> Result<usize, Error>
Source§fn send_messages<C: IsA<Cancellable>>(
&self,
messages: &mut [OutputMessage<'_>],
flags: i32,
timeout: Option<Duration>,
cancellable: Option<&C>,
) -> Result<usize, Error>
fn send_messages<C: IsA<Cancellable>>( &self, messages: &mut [OutputMessage<'_>], flags: i32, timeout: Option<Duration>, cancellable: Option<&C>, ) -> Result<usize, Error>
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<O> InitableExt for O
impl<O> InitableExt for O
Source§impl<T> IntoClosureReturnValue for T
impl<T> IntoClosureReturnValue for T
fn into_closure_return_value(self) -> Option<Value>
Source§impl<U> IsSubclassableExt for Uwhere
U: IsClass + ParentClassIs,
impl<U> IsSubclassableExt for Uwhere
U: IsClass + ParentClassIs,
fn parent_class_init<T>(class: &mut Class<U>)
fn parent_instance_init<T>(instance: &mut InitializingObject<T>)
Source§impl<T> ObjectExt for Twhere
T: ObjectType,
impl<T> ObjectExt for Twhere
T: ObjectType,
Source§fn is<U>(&self) -> boolwhere
U: StaticType,
fn is<U>(&self) -> boolwhere
U: StaticType,
true
if the object is an instance of (can be cast to) T
.Source§fn object_class(&self) -> &Class<Object>
fn object_class(&self) -> &Class<Object>
ObjectClass
of the object. Read moreSource§fn class_of<U>(&self) -> Option<&Class<U>>where
U: IsClass,
fn class_of<U>(&self) -> Option<&Class<U>>where
U: IsClass,
T
. Read moreSource§fn interface<U>(&self) -> Option<InterfaceRef<'_, U>>where
U: IsInterface,
fn interface<U>(&self) -> Option<InterfaceRef<'_, U>>where
U: IsInterface,
T
of the object. Read moreSource§fn set_property_from_value(&self, property_name: &str, value: &Value)
fn set_property_from_value(&self, property_name: &str, value: &Value)
Source§fn set_properties(&self, property_values: &[(&str, &dyn ToValue)])
fn set_properties(&self, property_values: &[(&str, &dyn ToValue)])
Source§fn set_properties_from_value(&self, property_values: &[(&str, Value)])
fn set_properties_from_value(&self, property_values: &[(&str, Value)])
Source§fn property<V>(&self, property_name: &str) -> Vwhere
V: for<'b> FromValue<'b> + 'static,
fn property<V>(&self, property_name: &str) -> Vwhere
V: for<'b> FromValue<'b> + 'static,
property_name
of the object and cast it to the type V. Read moreSource§fn property_value(&self, property_name: &str) -> Value
fn property_value(&self, property_name: &str) -> Value
property_name
of the object. Read moreSource§fn property_type(&self, property_name: &str) -> Option<Type>
fn property_type(&self, property_name: &str) -> Option<Type>
property_name
of this object. Read moreSource§fn find_property(&self, property_name: &str) -> Option<ParamSpec>
fn find_property(&self, property_name: &str) -> Option<ParamSpec>
ParamSpec
of the property property_name
of this object.Source§fn list_properties(&self) -> PtrSlice<ParamSpec>
fn list_properties(&self) -> PtrSlice<ParamSpec>
ParamSpec
of the properties of this object.Source§fn freeze_notify(&self) -> PropertyNotificationFreezeGuard
fn freeze_notify(&self) -> PropertyNotificationFreezeGuard
Source§unsafe fn set_qdata<QD>(&self, key: Quark, value: QD)where
QD: 'static,
unsafe fn set_qdata<QD>(&self, key: Quark, value: QD)where
QD: 'static,
key
. Read moreSource§unsafe fn qdata<QD>(&self, key: Quark) -> Option<NonNull<QD>>where
QD: 'static,
unsafe fn qdata<QD>(&self, key: Quark) -> Option<NonNull<QD>>where
QD: 'static,
key
. Read moreSource§unsafe fn steal_qdata<QD>(&self, key: Quark) -> Option<QD>where
QD: 'static,
unsafe fn steal_qdata<QD>(&self, key: Quark) -> Option<QD>where
QD: 'static,
key
. Read moreSource§unsafe fn set_data<QD>(&self, key: &str, value: QD)where
QD: 'static,
unsafe fn set_data<QD>(&self, key: &str, value: QD)where
QD: 'static,
key
. Read moreSource§unsafe fn data<QD>(&self, key: &str) -> Option<NonNull<QD>>where
QD: 'static,
unsafe fn data<QD>(&self, key: &str) -> Option<NonNull<QD>>where
QD: 'static,
key
. Read moreSource§unsafe fn steal_data<QD>(&self, key: &str) -> Option<QD>where
QD: 'static,
unsafe fn steal_data<QD>(&self, key: &str) -> Option<QD>where
QD: 'static,
key
. Read moreSource§fn block_signal(&self, handler_id: &SignalHandlerId)
fn block_signal(&self, handler_id: &SignalHandlerId)
Source§fn unblock_signal(&self, handler_id: &SignalHandlerId)
fn unblock_signal(&self, handler_id: &SignalHandlerId)
Source§fn stop_signal_emission(&self, signal_id: SignalId, detail: Option<Quark>)
fn stop_signal_emission(&self, signal_id: SignalId, detail: Option<Quark>)
Source§fn stop_signal_emission_by_name(&self, signal_name: &str)
fn stop_signal_emission_by_name(&self, signal_name: &str)
Source§fn connect<F>(
&self,
signal_name: &str,
after: bool,
callback: F,
) -> SignalHandlerId
fn connect<F>( &self, signal_name: &str, after: bool, callback: F, ) -> SignalHandlerId
signal_name
on this object. Read moreSource§fn connect_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F,
) -> SignalHandlerId
fn connect_id<F>( &self, signal_id: SignalId, details: Option<Quark>, after: bool, callback: F, ) -> SignalHandlerId
signal_id
on this object. Read moreSource§fn connect_local<F>(
&self,
signal_name: &str,
after: bool,
callback: F,
) -> SignalHandlerId
fn connect_local<F>( &self, signal_name: &str, after: bool, callback: F, ) -> SignalHandlerId
signal_name
on this object. Read moreSource§fn connect_local_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F,
) -> SignalHandlerId
fn connect_local_id<F>( &self, signal_id: SignalId, details: Option<Quark>, after: bool, callback: F, ) -> SignalHandlerId
signal_id
on this object. Read moreSource§unsafe fn connect_unsafe<F>(
&self,
signal_name: &str,
after: bool,
callback: F,
) -> SignalHandlerId
unsafe fn connect_unsafe<F>( &self, signal_name: &str, after: bool, callback: F, ) -> SignalHandlerId
signal_name
on this object. Read moreSource§unsafe fn connect_unsafe_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F,
) -> SignalHandlerId
unsafe fn connect_unsafe_id<F>( &self, signal_id: SignalId, details: Option<Quark>, after: bool, callback: F, ) -> SignalHandlerId
signal_id
on this object. Read moreSource§fn connect_closure(
&self,
signal_name: &str,
after: bool,
closure: RustClosure,
) -> SignalHandlerId
fn connect_closure( &self, signal_name: &str, after: bool, closure: RustClosure, ) -> SignalHandlerId
signal_name
on this object. Read moreSource§fn connect_closure_id(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
closure: RustClosure,
) -> SignalHandlerId
fn connect_closure_id( &self, signal_id: SignalId, details: Option<Quark>, after: bool, closure: RustClosure, ) -> SignalHandlerId
signal_id
on this object. Read moreSource§fn watch_closure(&self, closure: &impl AsRef<Closure>)
fn watch_closure(&self, closure: &impl AsRef<Closure>)
closure
to the lifetime of the object. When
the object’s reference count drops to zero, the closure will be
invalidated. An invalidated closure will ignore any calls to
invoke_with_values
, or
invoke
when using Rust closures.Source§fn emit<R>(&self, signal_id: SignalId, args: &[&dyn ToValue]) -> Rwhere
R: TryFromClosureReturnValue,
fn emit<R>(&self, signal_id: SignalId, args: &[&dyn ToValue]) -> Rwhere
R: TryFromClosureReturnValue,
Source§fn emit_with_values(&self, signal_id: SignalId, args: &[Value]) -> Option<Value>
fn emit_with_values(&self, signal_id: SignalId, args: &[Value]) -> Option<Value>
Self::emit
but takes Value
for the arguments.Source§fn emit_by_name<R>(&self, signal_name: &str, args: &[&dyn ToValue]) -> Rwhere
R: TryFromClosureReturnValue,
fn emit_by_name<R>(&self, signal_name: &str, args: &[&dyn ToValue]) -> Rwhere
R: TryFromClosureReturnValue,
Source§fn emit_by_name_with_values(
&self,
signal_name: &str,
args: &[Value],
) -> Option<Value>
fn emit_by_name_with_values( &self, signal_name: &str, args: &[Value], ) -> Option<Value>
Source§fn emit_by_name_with_details<R>(
&self,
signal_name: &str,
details: Quark,
args: &[&dyn ToValue],
) -> Rwhere
R: TryFromClosureReturnValue,
fn emit_by_name_with_details<R>(
&self,
signal_name: &str,
details: Quark,
args: &[&dyn ToValue],
) -> Rwhere
R: TryFromClosureReturnValue,
Source§fn emit_by_name_with_details_and_values(
&self,
signal_name: &str,
details: Quark,
args: &[Value],
) -> Option<Value>
fn emit_by_name_with_details_and_values( &self, signal_name: &str, details: Quark, args: &[Value], ) -> Option<Value>
Source§fn emit_with_details<R>(
&self,
signal_id: SignalId,
details: Quark,
args: &[&dyn ToValue],
) -> Rwhere
R: TryFromClosureReturnValue,
fn emit_with_details<R>(
&self,
signal_id: SignalId,
details: Quark,
args: &[&dyn ToValue],
) -> Rwhere
R: TryFromClosureReturnValue,
Source§fn emit_with_details_and_values(
&self,
signal_id: SignalId,
details: Quark,
args: &[Value],
) -> Option<Value>
fn emit_with_details_and_values( &self, signal_id: SignalId, details: Quark, args: &[Value], ) -> Option<Value>
Source§fn disconnect(&self, handler_id: SignalHandlerId)
fn disconnect(&self, handler_id: SignalHandlerId)
Source§fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId
fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId
notify
signal of the object. Read moreSource§fn connect_notify_local<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId
fn connect_notify_local<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId
notify
signal of the object. Read moreSource§unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F,
) -> SignalHandlerId
unsafe fn connect_notify_unsafe<F>( &self, name: Option<&str>, f: F, ) -> SignalHandlerId
notify
signal of the object. Read moreSource§fn notify(&self, property_name: &str)
fn notify(&self, property_name: &str)
Source§fn notify_by_pspec(&self, pspec: &ParamSpec)
fn notify_by_pspec(&self, pspec: &ParamSpec)
Source§fn add_weak_ref_notify<F>(&self, f: F) -> WeakRefNotify<T>
fn add_weak_ref_notify<F>(&self, f: F) -> WeakRefNotify<T>
Source§fn add_weak_ref_notify_local<F>(&self, f: F) -> WeakRefNotify<T>where
F: FnOnce() + 'static,
fn add_weak_ref_notify_local<F>(&self, f: F) -> WeakRefNotify<T>where
F: FnOnce() + 'static,
Source§fn bind_property<'a, 'f, 't, O>(
&'a self,
source_property: &'a str,
target: &'a O,
target_property: &'a str,
) -> BindingBuilder<'a, 'f, 't>where
O: ObjectType,
fn bind_property<'a, 'f, 't, O>(
&'a self,
source_property: &'a str,
target: &'a O,
target_property: &'a str,
) -> BindingBuilder<'a, 'f, 't>where
O: ObjectType,
Source§unsafe fn run_dispose(&self)
unsafe fn run_dispose(&self)
Source§impl<T> PropertyGet for Twhere
T: HasParamSpec,
impl<T> PropertyGet for Twhere
T: HasParamSpec,
Source§impl<O> SocketExt for O
impl<O> SocketExt for O
Source§fn accept(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<Socket, Error>
fn accept( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<Socket, Error>
Source§fn bind(
&self,
address: &impl IsA<SocketAddress>,
allow_reuse: bool,
) -> Result<(), Error>
fn bind( &self, address: &impl IsA<SocketAddress>, allow_reuse: bool, ) -> Result<(), Error>
Source§fn check_connect_result(&self) -> Result<(), Error>
fn check_connect_result(&self) -> Result<(), Error>
Source§fn close(&self) -> Result<(), Error>
fn close(&self) -> Result<(), Error>
Source§fn condition_check(&self, condition: IOCondition) -> IOCondition
fn condition_check(&self, condition: IOCondition) -> IOCondition
Source§fn condition_timed_wait(
&self,
condition: IOCondition,
timeout_us: i64,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<(), Error>
fn condition_timed_wait( &self, condition: IOCondition, timeout_us: i64, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>
Source§fn condition_wait(
&self,
condition: IOCondition,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<(), Error>
fn condition_wait( &self, condition: IOCondition, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>
Source§fn connect(
&self,
address: &impl IsA<SocketAddress>,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<(), Error>
fn connect( &self, address: &impl IsA<SocketAddress>, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>
Source§fn connection_factory_create_connection(&self) -> SocketConnection
fn connection_factory_create_connection(&self) -> SocketConnection
Source§fn available_bytes(&self) -> isize
fn available_bytes(&self) -> isize
Source§fn is_blocking(&self) -> bool
fn is_blocking(&self) -> bool
Source§fn is_broadcast(&self) -> bool
fn is_broadcast(&self) -> bool
Source§fn credentials(&self) -> Result<Credentials, Error>
fn credentials(&self) -> Result<Credentials, Error>
SocketFamily::Unix
sockets). Read moreSource§fn family(&self) -> SocketFamily
fn family(&self) -> SocketFamily
Source§fn is_keepalive(&self) -> bool
fn is_keepalive(&self) -> bool
Source§fn listen_backlog(&self) -> i32
fn listen_backlog(&self) -> i32
Source§fn local_address(&self) -> Result<SocketAddress, Error>
fn local_address(&self) -> Result<SocketAddress, Error>
Source§fn is_multicast_loopback(&self) -> bool
fn is_multicast_loopback(&self) -> bool
Source§fn multicast_ttl(&self) -> u32
fn multicast_ttl(&self) -> u32
Source§fn option(&self, level: i32, optname: i32) -> Result<i32, Error>
fn option(&self, level: i32, optname: i32) -> Result<i32, Error>
Source§fn protocol(&self) -> SocketProtocol
fn protocol(&self) -> SocketProtocol
Source§fn remote_address(&self) -> Result<SocketAddress, Error>
fn remote_address(&self) -> Result<SocketAddress, Error>
Source§fn socket_type(&self) -> SocketType
fn socket_type(&self) -> SocketType
Source§fn timeout(&self) -> u32
fn timeout(&self) -> u32
Source§fn ttl(&self) -> u32
fn ttl(&self) -> u32
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Source§fn join_multicast_group(
&self,
group: &impl IsA<InetAddress>,
source_specific: bool,
iface: Option<&str>,
) -> Result<(), Error>
fn join_multicast_group( &self, group: &impl IsA<InetAddress>, source_specific: bool, iface: Option<&str>, ) -> Result<(), Error>
SocketType::Datagram
socket, and must have
been bound to an appropriate interface and port with
g_socket_bind(). Read moreSource§fn join_multicast_group_ssm(
&self,
group: &impl IsA<InetAddress>,
source_specific: Option<&impl IsA<InetAddress>>,
iface: Option<&str>,
) -> Result<(), Error>
fn join_multicast_group_ssm( &self, group: &impl IsA<InetAddress>, source_specific: Option<&impl IsA<InetAddress>>, iface: Option<&str>, ) -> Result<(), Error>
SocketType::Datagram
socket, and must have
been bound to an appropriate interface and port with
g_socket_bind(). Read moreSource§fn leave_multicast_group(
&self,
group: &impl IsA<InetAddress>,
source_specific: bool,
iface: Option<&str>,
) -> Result<(), Error>
fn leave_multicast_group( &self, group: &impl IsA<InetAddress>, source_specific: bool, iface: Option<&str>, ) -> Result<(), Error>
Source§fn leave_multicast_group_ssm(
&self,
group: &impl IsA<InetAddress>,
source_specific: Option<&impl IsA<InetAddress>>,
iface: Option<&str>,
) -> Result<(), Error>
fn leave_multicast_group_ssm( &self, group: &impl IsA<InetAddress>, source_specific: Option<&impl IsA<InetAddress>>, iface: Option<&str>, ) -> Result<(), Error>
Source§fn listen(&self) -> Result<(), Error>
fn listen(&self) -> Result<(), Error>
Source§fn set_blocking(&self, blocking: bool)
fn set_blocking(&self, blocking: bool)
IOErrorEnum::WouldBlock
error. Read moreSource§fn set_broadcast(&self, broadcast: bool)
fn set_broadcast(&self, broadcast: bool)
Source§fn set_keepalive(&self, keepalive: bool)
fn set_keepalive(&self, keepalive: bool)
SO_KEEPALIVE
flag on the underlying socket. When
this flag is set on a socket, the system will attempt to verify that the
remote socket endpoint is still present if a sufficiently long period of
time passes with no data being exchanged. If the system is unable to
verify the presence of the remote endpoint, it will automatically close
the connection. Read moreSource§fn set_listen_backlog(&self, backlog: i32)
fn set_listen_backlog(&self, backlog: i32)
Source§fn set_multicast_loopback(&self, loopback: bool)
fn set_multicast_loopback(&self, loopback: bool)
Source§fn set_multicast_ttl(&self, ttl: u32)
fn set_multicast_ttl(&self, ttl: u32)
Source§fn set_option(&self, level: i32, optname: i32, value: i32) -> Result<(), Error>
fn set_option(&self, level: i32, optname: i32, value: i32) -> Result<(), Error>
Source§fn set_timeout(&self, timeout: u32)
fn set_timeout(&self, timeout: u32)
Source§fn set_ttl(&self, ttl: u32)
fn set_ttl(&self, ttl: u32)
Source§fn shutdown(
&self,
shutdown_read: bool,
shutdown_write: bool,
) -> Result<(), Error>
fn shutdown( &self, shutdown_read: bool, shutdown_write: bool, ) -> Result<(), Error>
Source§fn speaks_ipv4(&self) -> bool
fn speaks_ipv4(&self) -> bool
Source§fn type_(&self) -> SocketType
fn type_(&self) -> SocketType
fn connect_blocking_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_broadcast_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_keepalive_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_listen_backlog_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_local_address_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_multicast_loopback_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_multicast_ttl_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_remote_address_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_timeout_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_ttl_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Source§impl<O> SocketExtManual for O
impl<O> SocketExtManual for O
Source§fn receive<B: AsMut<[u8]>, C: IsA<Cancellable>>(
&self,
buffer: B,
cancellable: Option<&C>,
) -> Result<usize, Error>
fn receive<B: AsMut<[u8]>, C: IsA<Cancellable>>( &self, buffer: B, cancellable: Option<&C>, ) -> Result<usize, Error>
Source§fn receive_from<B: AsMut<[u8]>, C: IsA<Cancellable>>(
&self,
buffer: B,
cancellable: Option<&C>,
) -> Result<(usize, SocketAddress), Error>
fn receive_from<B: AsMut<[u8]>, C: IsA<Cancellable>>( &self, buffer: B, cancellable: Option<&C>, ) -> Result<(usize, SocketAddress), Error>
Source§fn receive_message<C: IsA<Cancellable>>(
&self,
address: Option<&mut Option<SocketAddress>>,
vectors: &mut [InputVector<'_>],
control_messages: Option<&mut SocketControlMessages>,
flags: i32,
cancellable: Option<&C>,
) -> Result<(usize, i32), Error>
fn receive_message<C: IsA<Cancellable>>( &self, address: Option<&mut Option<SocketAddress>>, vectors: &mut [InputVector<'_>], control_messages: Option<&mut SocketControlMessages>, flags: i32, cancellable: Option<&C>, ) -> Result<(usize, i32), Error>
Source§fn receive_messages<C: IsA<Cancellable>>(
&self,
messages: &mut [InputMessage<'_>],
flags: i32,
cancellable: Option<&C>,
) -> Result<usize, Error>
fn receive_messages<C: IsA<Cancellable>>( &self, messages: &mut [InputMessage<'_>], flags: i32, cancellable: Option<&C>, ) -> Result<usize, Error>
Source§fn receive_with_blocking<B: AsMut<[u8]>, C: IsA<Cancellable>>(
&self,
buffer: B,
blocking: bool,
cancellable: Option<&C>,
) -> Result<usize, Error>
fn receive_with_blocking<B: AsMut<[u8]>, C: IsA<Cancellable>>( &self, buffer: B, blocking: bool, cancellable: Option<&C>, ) -> Result<usize, Error>
Source§fn send<B: AsRef<[u8]>, C: IsA<Cancellable>>(
&self,
buffer: B,
cancellable: Option<&C>,
) -> Result<usize, Error>
fn send<B: AsRef<[u8]>, C: IsA<Cancellable>>( &self, buffer: B, cancellable: Option<&C>, ) -> Result<usize, Error>
Source§fn send_message<P: IsA<SocketAddress>, C: IsA<Cancellable>>(
&self,
address: Option<&P>,
vectors: &[OutputVector<'_>],
messages: &[SocketControlMessage],
flags: i32,
cancellable: Option<&C>,
) -> Result<usize, Error>
fn send_message<P: IsA<SocketAddress>, C: IsA<Cancellable>>( &self, address: Option<&P>, vectors: &[OutputVector<'_>], messages: &[SocketControlMessage], flags: i32, cancellable: Option<&C>, ) -> Result<usize, Error>
Source§fn send_message_with_timeout<P: IsA<SocketAddress>, C: IsA<Cancellable>>(
&self,
address: Option<&P>,
vectors: &[OutputVector<'_>],
messages: &[SocketControlMessage],
flags: i32,
timeout: Option<Duration>,
cancellable: Option<&C>,
) -> Result<(PollableReturn, usize), Error>
fn send_message_with_timeout<P: IsA<SocketAddress>, C: IsA<Cancellable>>( &self, address: Option<&P>, vectors: &[OutputVector<'_>], messages: &[SocketControlMessage], flags: i32, timeout: Option<Duration>, cancellable: Option<&C>, ) -> Result<(PollableReturn, usize), Error>
v2_60
only.