block-devs 0.1.0

Safe portable wrapper for block device opperations
Documentation
  • Coverage
  • 91.67%
    11 out of 12 items documented1 out of 12 items with examples
  • Size
  • Source code size: 18.47 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 681.62 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s Average build duration of successful builds.
  • all releases: 16s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • aj-bagwell/block-devs
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • aj-bagwell

Safe portable wrapper for block device opperations

[![crates.io](http://meritbadge.herokuapp.com/block-devs](https://crates.io/crates/block-devs)

Documentation (Releases)

Block Devs provides safe wrappers for the ioctl call for dealing with block devices (USB sticks, SSDs, hard drives etc).

It aims to provide a consitent interface across all platforms for things like getting the number of bytes a disk has.

It does this by a extention trait on the standard File struct.

    use block-devs::BlockExt;
    use std::fs::File;
    
    let path = "/dev/sda2";
    let file = File::open(path)?;
    let bytes = file.get_block_device_size()?;
    let gb = bytes >> 30;

    println!("disk is {} blocks {}gb", bytes, gb);

Supported Platforms

It currently supports Linux, OS X, and Free BSD, pull requests for other platforms are welcome

License

block-devs is licensed under the MIT license. See LICENSE for more details.