sys_util: impl Pollable for File

Files are Pollable because they have an FD. Whether this makes sense for
any specific `File` is not enforced, but it will never be unsafe or
undefined when used with Poller.

BUG=chromium:793688
TEST=None

Change-Id: I2ce7ffd1b408bcee5ffbb3738d26339aa0c466e0
Reviewed-on: https://chromium-review.googlesource.com/985617
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
This commit is contained in:
Zach Reizner 2018-03-28 17:34:40 -07:00 committed by chrome-bot
parent 1028f53ed2
commit b2e528b575

View file

@ -55,6 +55,12 @@ unsafe impl Pollable for UnixDatagram {
}
}
unsafe impl Pollable for File {
fn pollable_fd(&self) -> RawFd {
self.as_raw_fd()
}
}
/// Used to poll multiple `Pollable` objects at once.
///
/// # Example