Derive Macro AsFileDescriptor

Source
#[derive(AsFileDescriptor)]
{
    // Attributes available to this derive:
    #[read]
    #[write]
    #[descriptor]
    #[duck]
}
Expand description

#[derive(AsFileDescriptor)]

Derives std::os::fd::{AsFd, AsRawFd} and std::os::windows::io::{AsHandle, AsRawHandle} for the given struct.

Supported attributes:

  • #[descriptor]: Marks the field as a file descriptor.
  • #[descriptor(as_ref)]: Delegates the field to the inner type using AsRef/AsMut.
  • #[descriptor(deref)]: Delegates the field to the inner type using Deref/DerefMut.
  • #[descriptor(<function>=<override>)]: Overrides the default <function> method with the given override function.