Struct nvml_wrapper::high_level::event_loop::EventLoop
source · pub struct EventLoop<'nvml> { /* private fields */ }
Expand description
Holds the EventSet
utilized within an event loop.
A usage example is available (examples/event_loop.rs
). It can be run as
follows:
cargo run --example event_loop
Implementations§
source§impl<'nvml> EventLoop<'nvml>
impl<'nvml> EventLoop<'nvml>
sourcepub fn register_device(
self,
device: &'nvml Device<'nvml>
) -> Result<Self, NvmlErrorWithSource>
pub fn register_device( self, device: &'nvml Device<'nvml> ) -> Result<Self, NvmlErrorWithSource>
Register another device that this EventLoop
should receive events for.
This method takes ownership of this struct and then hands it back to you if everything went well with the registration process.
§Errors
Uninitialized
, if the library has not been successfully initializedGpuLost
, if a GPU has fallen off the bus or is otherwise inaccessibleUnknown
, on any unexpected error
§Platform Support
Only supports Linux.
sourcepub fn run_forever<F>(&mut self, callback: F)
pub fn run_forever<F>(&mut self, callback: F)
Handle events with the given callback until the loop is manually interrupted.
§Errors
The function itself does not return anything. You will be given errors to
handle within your closure if they occur; events are handed to you wrapped
in a Result
.
The errors that you will need to handle are:
Uninitialized
, if the library has not been successfully initializedGpuLost
, if a GPU has fallen off the bus or is otherwise inaccessibleUnknown
, on any unexpected error
§Examples
See the event_loop
example in the examples
directory at the root.
§Platform Support
Only supports Linux.
sourcepub fn as_inner(&'nvml self) -> &'nvml EventSet<'nvml>
pub fn as_inner(&'nvml self) -> &'nvml EventSet<'nvml>
Obtain a reference to the EventSet
contained within this struct.
sourcepub fn as_mut_inner(&'nvml mut self) -> &'nvml mut EventSet<'nvml>
pub fn as_mut_inner(&'nvml mut self) -> &'nvml mut EventSet<'nvml>
Obtain a mutable reference to the EventSet
contained within this
struct.
sourcepub fn into_inner(self) -> EventSet<'nvml>
pub fn into_inner(self) -> EventSet<'nvml>
Consumes this EventLoop
and yields the EventSet
contained within.