Skip to main content

EventSource

Struct EventSource 

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

Event source.

Reference to the official documentation:

https://www.virtualbox.org/sdkref/interface_i_event_source.html

Implementations§

Source§

impl EventSource

Source

pub fn create_listener(&self) -> Result<EventListener, VboxError>

Creates a new listener object, useful for passive mode.

§Returns

Returns a new instance of the EventListener class on success, or a VboxError on failure.

§Example

use virtualbox_rs::{Session, VirtualBox};

let vbox = VirtualBox::init().unwrap();
let event_source = vbox.get_event_source().unwrap();
let listener = event_source.create_listener().unwrap();
Source

pub fn create_aggregator( &self, sources: Vec<&EventSource>, ) -> Result<EventSource, VboxError>

Creates a new listener object, useful for passive mode.

§Arguments
  • sources - Subordinate event source this one aggregates.
§Returns

Returns a new instance of the EventSource class on success, or a VboxError on failure.

§Example

use virtualbox_rs::{Session, VirtualBox};

let vbox = VirtualBox::init().unwrap();
let event_source1 = vbox.get_event_source().unwrap();
let event_source2 = vbox.get_event_source().unwrap();
let event_source3 = vbox.get_event_source().unwrap();
let event_source = event_source1.create_aggregator(vec![&event_source2, &event_source3]);
Source

pub fn register_listener( &self, event_listener: &EventListener, event_types: Vec<VBoxEventType>, active: bool, ) -> Result<(), VboxError>

Creates a new listener object, useful for passive mode.

§Arguments
  • event_listener - EventListener to register.
  • event_types - Event types listener is interested in. One can use wildcards like - VBoxEventType::Any to specify wildcards, matching more than one event.
  • active - Which mode this listener is operating in.
§Returns

Returns Ok(()) on success, or a VboxError on failure.

§Example

use virtualbox_rs::{Session, VirtualBox};
use virtualbox_rs::enums::VBoxEventType;

let vbox = VirtualBox::init().unwrap();
let event_source = vbox.get_event_source().unwrap();
let listener = event_source.create_listener().unwrap();
event_source.register_listener(&listener, vec![VBoxEventType::Any], false).unwrap()
Source

pub fn unregister_listener( &self, event_listener: &EventListener, ) -> Result<(), VboxError>

Creates a new listener object, useful for passive mode.

§Arguments
§Returns

Returns Ok(()) on success, or a VboxError on failure.

§Example

use virtualbox_rs::{Session, VirtualBox};
use virtualbox_rs::enums::VBoxEventType;

let vbox = VirtualBox::init().unwrap();
let event_source = vbox.get_event_source().unwrap();
let listener = event_source.create_listener().unwrap();
event_source.register_listener(&listener, vec![VBoxEventType::Any], false).unwrap();
event_source.unregister_listener(&listener).unwrap();
Source

pub fn get_event( &self, event_listener: &EventListener, timeout: i32, ) -> Result<Event, VboxError>

Creates a new listener object, useful for passive mode.

§Arguments
§Returns

Returns Ok(()) on success, or a VboxError on failure.

§Example

use virtualbox_rs::{Session, VirtualBox};

let vbox = VirtualBox::init().unwrap();
let event_source = vbox.get_event_source().unwrap();
let listener = event_source.create_listener().unwrap();
let event = event_source.get_event(&listener, 20).unwrap();
Source

pub fn event_processed( &self, event_listener: &EventListener, event: &Event, ) -> Result<(), VboxError>

Creates a new listener object, useful for passive mode.

§Arguments
§Returns

Returns Ok(()) on success, or a VboxError on failure.

§Example

use virtualbox_rs::{Session, VirtualBox};

let vbox = VirtualBox::init().unwrap();
let event_source = vbox.get_event_source().unwrap();
let listener = event_source.create_listener().unwrap();
let event = event_source.get_event(&listener, 20).unwrap();
event_source.event_processed(&listener, &event).unwrap()

Trait Implementations§

Source§

impl Debug for EventSource

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Drop for EventSource

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for EventSource

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.