Eject
A Rust library to control the tray of your CD drive.
Currently supporting Windows and Linux.
Features
- Find installed drives.
- Open, close and lock the tray.
- Query current tray position and whether there's a disc inside.
Examples
Basic usage
use ;
// Open the drive at this path
let cdrom = open?;
// Or get the first one available
let cdrom_path = cd_drives.next.unwrap;
let cdrom = open?;
// Open the tray
cdrom.eject?;
Find all CD drives
use ;
// Get the paths of all CD drives
for path in cd_drives
Get drive status
use ;
// Open a drive
let drive = open?;
// Print its status
match drive.status?