aboutsummaryrefslogtreecommitdiffstats
path: root/zone_core/src/lib.rs
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2022-02-17 22:55:33 -0600
committerToby Vincent <tobyv13@gmail.com>2022-02-17 22:55:33 -0600
commit22039b683f3c111e42c9eb212c45d304b9c8ac10 (patch)
treec6de813929f40f228b056ce7d55ae2ade0a27809 /zone_core/src/lib.rs
parent239cf15875b88281873d0b443c288e4906733579 (diff)
refactor(zone_zfs): convert zfs crate to singleton
Refactored the zone_zfs to be a singleton with a psudo-builder pattern rocket is now managing the singleton, instead of the config.
Diffstat (limited to 'zone_core/src/lib.rs')
-rw-r--r--zone_core/src/lib.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/zone_core/src/lib.rs b/zone_core/src/lib.rs
index 25fe33a..6801ee8 100644
--- a/zone_core/src/lib.rs
+++ b/zone_core/src/lib.rs
@@ -76,7 +76,7 @@ impl<'r> Responder<'r, 'static> for Container {
}
impl TryFrom<FileSystem> for Container {
- type Error = zone_zfs::Error;
+ type Error = zone_zfs::error::Error;
fn try_from(file_system: FileSystem) -> Result<Self, Self::Error> {
let path_buf = PathBuf::from(&file_system)
@@ -116,11 +116,13 @@ impl TryFrom<zone_nspawn::Container> for Container {
type Error = zone_nspawn::Error;
fn try_from(value: zone_nspawn::Container) -> Result<Self, Self::Error> {
- // id, template, user
- let v: Vec<&str> = value.machine.split("-").collect();
+ // id, template, user
+ let v: Vec<&str> = value.machine.split('-').collect();
Ok(Container {
- id: v[0].parse().map_err(|err| Self::Error::Parsing(format!("Failed to parse container id: {:?}", err)))?,
+ id: v[0].parse().map_err(|err| {
+ Self::Error::Parsing(format!("Failed to parse container id: {:?}", err))
+ })?,
template: v[1].to_owned(),
user: v[2].to_owned(),
status: ContainerStatus::Running,