Dependencies bump and compilation fixes

This commit is contained in:
Roey Darwish Dror
2020-03-01 21:25:26 +02:00
parent 11c5b04677
commit 7c88f4527d
10 changed files with 199 additions and 237 deletions

View File

@@ -17,11 +17,11 @@ pub struct EncryptedDevice<'t, 'o> {
cryptsetup: &'t Tool,
name: String,
path: PathBuf,
origin: PhantomData<&'o BlockDevice>,
origin: PhantomData<&'o dyn BlockDevice>,
}
impl<'t, 'o> EncryptedDevice<'t, 'o> {
pub fn prepare(cryptsetup: &Tool, device: &BlockDevice) -> Result<(), Error> {
pub fn prepare(cryptsetup: &Tool, device: &dyn BlockDevice) -> Result<(), Error> {
debug!("Preparing encrypted device in {}", device.path().display());
cryptsetup
.execute()
@@ -35,7 +35,7 @@ impl<'t, 'o> EncryptedDevice<'t, 'o> {
pub fn open(
cryptsetup: &'t Tool,
device: &'o BlockDevice,
device: &'o dyn BlockDevice,
name: String,
) -> Result<EncryptedDevice<'t, 'o>, Error> {
debug!(
@@ -85,7 +85,7 @@ impl<'t, 'o> BlockDevice for EncryptedDevice<'t, 'o> {
}
}
pub fn is_encrypted_device(device: &BlockDevice) -> Result<bool, Error> {
pub fn is_encrypted_device(device: &dyn BlockDevice) -> Result<bool, Error> {
let mut f = fs::OpenOptions::new()
.read(true)
.write(false)

View File

@@ -23,12 +23,12 @@ impl FilesystemType {
#[derive(Debug)]
pub struct Filesystem<'a> {
fs_type: FilesystemType,
block: &'a BlockDevice,
block: &'a dyn BlockDevice,
}
impl<'a> Filesystem<'a> {
pub fn format(
block: &'a BlockDevice,
block: &'a dyn BlockDevice,
fs_type: FilesystemType,
mkfs: &Tool,
) -> Result<Self, Error> {
@@ -43,11 +43,11 @@ impl<'a> Filesystem<'a> {
Ok(Self { fs_type, block })
}
pub fn from_partition(block: &'a BlockDevice, fs_type: FilesystemType) -> Self {
pub fn from_partition(block: &'a dyn BlockDevice, fs_type: FilesystemType) -> Self {
Self { fs_type, block }
}
pub fn block(&self) -> &BlockDevice {
pub fn block(&self) -> &dyn BlockDevice {
self.block
}

View File

@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
#[derive(Debug)]
pub struct Partition<'a> {
path: PathBuf,
origin: PhantomData<&'a Origin>,
origin: PhantomData<&'a dyn Origin>,
}
impl<'a> Partition<'a> {

View File

@@ -81,7 +81,7 @@ mod tests {
#[test]
fn sanity() {
let devices = get_removable_devices().unwrap();
let devices = get_storage_devices(false).unwrap();
println!("{:?}", devices);
}
}

View File

@@ -11,7 +11,7 @@ use std::path::{Path, PathBuf};
pub struct StorageDevice<'a> {
name: String,
path: PathBuf,
origin: PhantomData<&'a Origin>,
origin: PhantomData<&'a dyn Origin>,
}
impl<'a> StorageDevice<'a> {