Skip to main content

Module async

Module async 

Source
Expand description

This module provides tokio based async interface to libvirt API

§Examples

§Connect to local libvirtd and get list of domains

extern crate tokio_core;
extern crate libvirt_rpc;
extern crate futures;

use ::tokio_core::reactor::Core;
use libvirt_rpc::async::Client;
use libvirt_rpc::request;
use futures::Future;

fn main() {
    let mut core = Core::new().unwrap();
    let handle = core.handle(); 
    let client = Client::connect("/var/run/libvirt/libvirt-sock", &handle).unwrap();
    let result = core.run({
        client.auth()
          .and_then(|_| client.open())
          .and_then(|_| client.domain().list(request::ListAllDomainsFlags::DOMAINS_ACTIVE | request::ListAllDomainsFlags::DOMAINS_INACTIVE))
    }).unwrap();
    println!("{:?}", result);
}

Structs§

Client
Libvirt client
DomainOperations
Operations on libvirt domains
EventStream
LibvirtSink
LibvirtStream
PoolOperations
Operations on libvirt storage pools
VolumeOperations
Operations on libvirt storage volumes

Type Aliases§

LibvirtFuture