[]Struct gio::UnixSocketAddress

pub struct UnixSocketAddress(_, _);

Support for UNIX-domain (also known as local) sockets.

UNIX domain sockets are generally visible in the filesystem. However, some systems support abstract socket names which are not visible in the filesystem and not affected by the filesystem permissions, visibility, etc. Currently this is only supported under Linux. If you attempt to use abstract sockets on other systems, function calls may return IOErrorEnum::NotSupported errors. You can use UnixSocketAddress::abstract_names_supported to see if abstract names are supported.

Note that <gio/gunixsocketaddress.h> belongs to the UNIX-specific GIO interfaces, thus you have to use the gio-unix-2.0.pc pkg-config file when using it.

Implements

UnixSocketAddressExt, SocketAddressExt, glib::object::ObjectExt, SocketConnectableExt, UnixSocketAddressExtManual

Methods

impl UnixSocketAddress[src]

pub fn new(path: &Path) -> UnixSocketAddress[src]

Creates a new UnixSocketAddress for path.

To create abstract socket addresses, on systems that support that, use UnixSocketAddress::new_abstract.

path

the socket path

Returns

a new UnixSocketAddress

pub fn new_with_type(address_type: UnixSocketAddressPath) -> Self[src]

Creates a new UnixSocketAddress of type type_ with name path.

If type_ is UnixSocketAddressType::Path, this is equivalent to calling UnixSocketAddress::new.

If type_ is UnixSocketAddressType::Anonymous, path and path_len will be ignored.

If path_type is UnixSocketAddressType::Abstract, then path_len bytes of path will be copied to the socket's path, and only those bytes will be considered part of the name. (If path_len is -1, then path is assumed to be NUL-terminated.) For example, if path was "test", then calling SocketAddressExt::get_native_size on the returned socket would return 7 (2 bytes of overhead, 1 byte for the abstract-socket indicator byte, and 4 bytes for the name "test").

If path_type is UnixSocketAddressType::AbstractPadded, then path_len bytes of path will be copied to the socket's path, the rest of the path will be padded with 0 bytes, and the entire zero-padded buffer will be considered the name. (As above, if path_len is -1, then path is assumed to be NUL-terminated.) In this case, SocketAddressExt::get_native_size will always return the full size of a struct sockaddr_un, although UnixSocketAddressExt::get_path_len will still return just the length of path.

UnixSocketAddressType::Abstract is preferred over UnixSocketAddressType::AbstractPadded for new programs. Of course, when connecting to a server created by another process, you must use the appropriate type corresponding to how that process created its listening socket.

path

the name

path_len

the length of path, or -1

type_

a UnixSocketAddressType

Returns

a new UnixSocketAddress

impl UnixSocketAddress[src]

pub fn abstract_names_supported() -> bool[src]

Checks if abstract UNIX domain socket names are supported.

Returns

true if supported, false otherwise

Trait Implementations

impl Clone for UnixSocketAddress

impl Debug for UnixSocketAddress

impl Display for UnixSocketAddress[src]

impl Eq for UnixSocketAddress

impl Hash for UnixSocketAddress

impl IsA<SocketAddress> for UnixSocketAddress

impl IsA<SocketConnectable> for UnixSocketAddress

impl Ord for UnixSocketAddress

impl<T: ObjectType> PartialEq<T> for UnixSocketAddress

impl<T: ObjectType> PartialOrd<T> for UnixSocketAddress

impl Send for UnixSocketAddress[src]

impl StaticType for UnixSocketAddress

impl Sync for UnixSocketAddress[src]

Auto Trait Implementations

impl RefUnwindSafe for UnixSocketAddress

impl Unpin for UnixSocketAddress

impl UnwindSafe for UnixSocketAddress

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 
[src]

impl<T> Cast for T where
    T: ObjectType
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.