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:
- You can call take_raw_fd(). At this point UnixFd releases ownership. You are now responsible of closing the FD.
- 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
- 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.
- 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.
Trait Implementations
Allow for the comparison of UnixFd
even after the RawFd
has been taken, to see if they originally referred to the same thing.
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
impl RefUnwindSafe for UnixFd
impl UnwindSafe for UnixFd
Blanket Implementations
Mutably borrows from an owned value. Read more