Struct async_rustbus::rustbus_core::wire::UnixFd[][src]

pub struct UnixFd(_);
Expand description

UnixFd is a wrapper around RawFd, to ensure that opened FDs are closed again, while still having the possibility of having multiple references to it.

“Ownership” as in responsibility of closing the FD works as follows:

  1. You can call take_raw_fd(). At this point UnixFd releases ownership. You are now responsible of closing the FD.
  2. You can call get_raw_fd(). This will not release ownership, UnixFd will still close it if no more references to it exist.

UnixFds and messages

  1. When a UnixFd is marshalled rustbus will dup() the FD so that the message and the original UnixFd do not depend on each others lifetime. You are free to use or close the original one.
  2. When a UnixFd is unmarshalled rustbus will NOT dup() the FD. This means if you call take_raw_fd(), it is gone from the message too! If you do not want this, you have to call dup() and then get_raw_fd() or take_raw_fd()

Implementations

Gets a non-owning RawFd. If None is returned. then this UnixFd has already been taken by somebody else and is no longer valid.

Gets a owning RawFd from the UnixFd. Subsequent attempt to get the RawFd from other UnixFd referencing the same file descriptor will fail.

Duplicate the underlying FD so you can use it as you will. This is different from just calling clone(). Clone only makes a new ref to the same underlying FD.

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

Feeds this value into the given Hasher. Read more

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

Allow for the comparison of UnixFd even after the RawFd has been taken, to see if they originally referred to the same thing.

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

This method tests for !=.

Appends the signature of the type to the SignatureBuffer. Read more

Check if this type fulfills this signature. This may expect to only be called with valid signatures. But it might be called with the wrong signature. This means for example you must check the length before indexing. Read more

If this returns true, it indicates that for implementing type T, Rust’s [T] is identical to DBus’s array format and can be copied into a message after aligning the first element. Read more

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

Performs the conversion.

Performs the conversion.

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

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.