Skip to main content

HotplugMonitor

Struct HotplugMonitor 

Source
pub struct HotplugMonitor { /* private fields */ }
Expand description

A pollable watch on DRM hotplug.

Add AsFd to the poll set that already has the input devices and the card in it, and call dispatch when it is readable.

Implementations§

Source§

impl HotplugMonitor

Source

pub fn open(source: Source) -> Result<Self>

Start watching.

§Errors

CoreError::Io if udev is unavailable – no /run/udev, or a container without the netlink socket. A caller that cannot watch can still poll connectors on a timer; what it loses is knowing when.

Source

pub fn dispatch(&mut self, out: &mut Vec<HotplugEvent>)

Read every pending uevent, appending the ones that are hotplug.

Everything is drained whether or not it is kept, so the descriptor goes back to unreadable and a caller polling in a loop does not spin.

Trait Implementations§

Source§

impl AsFd for HotplugMonitor

Source§

fn as_fd(&self) -> BorrowedFd<'_>

Borrows the file descriptor. Read more
Source§

impl Debug for HotplugMonitor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

The socket has nothing printable in it; the descriptor is what a caller debugging a poll set is looking for.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsFilelike for T
where T: AsFd,

Source§

fn as_filelike(&self) -> BorrowedFd<'_>

Borrows the reference. Read more
Source§

fn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target>
where Target: FilelikeViewType,

Return a borrowing view of a resource which dereferences to a &Target. Read more
Source§

impl<T> AsSocketlike for T
where T: AsFd,

Source§

fn as_socketlike(&self) -> BorrowedFd<'_>

Borrows the reference.
Source§

fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>
where Target: SocketlikeViewType,

Return a borrowing view of a resource which dereferences to a &Target. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.