Struct gio::Credentials[][src]

pub struct Credentials(_);
Expand description

The Credentials type is a reference-counted wrapper for native credentials. This information is typically used for identifying, authenticating and authorizing other processes.

Some operating systems supports looking up the credentials of the remote peer of a communication endpoint - see e.g. SocketExt::credentials().

Some operating systems supports securely sending and receiving credentials over a Unix Domain Socket, see GUnixCredentialsMessage, g_unix_connection_send_credentials() and g_unix_connection_receive_credentials() for details.

On Linux, the native credential type is a struct ucred - see the unix(7) man page for details. This corresponds to CredentialsType::LinuxUcred.

On Apple operating systems (including iOS, tvOS, and macOS), the native credential type is a struct xucred. This corresponds to CredentialsType::AppleXucred.

On FreeBSD, Debian GNU/kFreeBSD, and GNU/Hurd, the native credential type is a struct cmsgcred. This corresponds to CredentialsType::FreebsdCmsgcred.

On NetBSD, the native credential type is a struct unpcbid. This corresponds to CredentialsType::NetbsdUnpcbid.

On OpenBSD, the native credential type is a struct sockpeercred. This corresponds to CredentialsType::OpenbsdSockpeercred.

On Solaris (including OpenSolaris and its derivatives), the native credential type is a ucred_t. This corresponds to CredentialsType::SolarisUcred.

Implements

glib::ObjectExt

Implementations

Creates a new Credentials object with credentials matching the the current process.

Returns

A Credentials. Free with g_object_unref().

This is supported on Unix only.

Tries to get the UNIX process identifier from self. This method is only available on UNIX platforms.

This operation can fail if Credentials is not supported on the OS or if the native credentials type does not contain information about the UNIX process ID (for example this is the case for CredentialsType::AppleXucred).

Returns

The UNIX process ID, or -1 if error is set.

This is supported on Unix only.

Tries to get the UNIX user identifier from self. This method is only available on UNIX platforms.

This operation can fail if Credentials is not supported on the OS or if the native credentials type does not contain information about the UNIX user.

Returns

The UNIX user identifier or -1 if error is set.

Checks if self and other_credentials is the same user.

This operation can fail if Credentials is not supported on the the OS.

other_credentials

A Credentials.

Returns

true if self and other_credentials has the same user, false otherwise or if error is set.

This is supported on Unix only.

Tries to set the UNIX user identifier on self. This method is only available on UNIX platforms.

This operation can fail if Credentials is not supported on the OS or if the native credentials type does not contain information about the UNIX user. It can also fail if the OS does not allow the use of “spoofed” credentials.

uid

The UNIX user identifier to set.

Returns

true if uid was set, false if error is set.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Upcasts an object to a superclass or interface T. Read more

Upcasts an object to a reference of its superclass or interface T. Read more

Tries to downcast to a subclass or interface implementor T. Read more

Tries to downcast to a reference of its subclass or interface implementor T. Read more

Tries to cast to an object of type 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 more

Tries to cast to reference to an object of type 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 more

Casts to T unconditionally. Read more

Casts to &T unconditionally. Read more

Performs the conversion.

Performs the conversion.

Returns true if the object is an instance of (can be cast to) T.

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Same as connect but takes a SignalId instead of a signal name.

Same as connect_local but takes a SignalId instead of a signal name.

Same as connect_unsafe but takes a SignalId instead of a signal name.

Emit signal by signal id.

Emit signal with details by signal id.

Emit signal by it’s name.

Same as emit but takes Value for the arguments.

Same as emit_by_name but takes Value for the arguments.

Same as emit_with_details but takes Value for the arguments.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Returns a SendValue clone of self.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.