#virtual-machine #virtualbox #vbox #vmi #networking

virtualbox_rs

A Rust library for interacting with VirtualBox, providing a safe and idiomatic interface to the VirtualBox API

3 unstable releases

0.2.2 Oct 25, 2024
0.2.1 Oct 1, 2024
0.2.0 Oct 1, 2024
0.1.7 Oct 1, 2024

#40 in Emulators

Download history 367/week @ 2024-09-28 42/week @ 2024-10-05 4/week @ 2024-10-12 65/week @ 2024-10-19 50/week @ 2024-10-26 1/week @ 2024-11-02

116 downloads per month

BSD-3-Clause and LGPL-2.1

1.5MB
18K SLoC

virtualbox_rs

is a Rust library for interacting with VirtualBox through its SDK.

This library provides a comprehensive set of bindings to manage VirtualBox VMs, including creating, deleting, and modifying virtual machines, handling snapshots, and configuring various VM settings such as network adapters, audio settings, and encryption.

Features

  • Create and manage VirtualBox VMs
  • Handle VM snapshots
  • Configure VM settings (network, audio, encryption, etc.)
  • Support for different VirtualBox API versions (6.1 and 7.0) !

Example

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

fn main() {
    let vbox = VirtualBox::init().unwrap();
    let mut session = Session::init().unwrap();
    let machine = vbox.find_machines("Freebsd_14").unwrap();
    machine.lock_machine(&mut session, SessionType::Shared).unwrap();

    let machine_mut = session.get_machine().unwrap();
    let progress = machine_mut.delete_snapshot_and_all_children("278ef54a-2e75-4aba-b212-551af4c69725").unwrap();
    progress.wait_for_completion(-1).unwrap();
}

Supported Platforms

This library has been tested on:

  • FreeBSD 14.0
  • Ubuntu 24.04

Note

Not everything has been implemented yet. The library emphasizes providing examples for each method, which should simplify its usage.

Dependencies

~0.5–2.9MB
~49K SLoC