ResolveDevice

Trait ResolveDevice 

Source
pub trait ResolveDevice {
    // Required method
    fn resolve_device(&self) -> Result<PathBuf>;
}
Expand description

A trait for resolving the underlying block device of a file or path.

This trait is implemented for Path and File, allowing you to resolve the block device using a consistent interface.

Required Methods§

Source

fn resolve_device(&self) -> Result<PathBuf>

Resolves the underlying block device path.

Returns the path to the block device (e.g., /dev/sda1, /dev/nvme0n1p1) that contains the file or directory.

§Errors

Returns an io::Error if:

  • The file/path cannot be accessed
  • The device information cannot be retrieved
  • The device cannot be mapped to a block device path
§Example
use blkpath::ResolveDevice;
use std::path::Path;

let path = Path::new("/home");
let device = path.resolve_device()?;
println!("Device: {}", device.display());

Implementations on Foreign Types§

Source§

impl ResolveDevice for &File

Source§

impl ResolveDevice for File

Source§

impl ResolveDevice for Path

Source§

impl ResolveDevice for PathBuf

Implementors§