A library for writing host-specific, single-binary configuration management and deployment tools
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
661 B

use std::borrow::Cow;
pub trait Resource {
fn get_type(&self) -> &str;
fn get_value(&self) -> &str;
}
pub struct UserResource<'a> {
pub name: &'a str
}
impl<'a> Resource for UserResource<'a> {
fn get_type(&self) -> &str { "user" }
fn get_value(&self) -> &str { self.name }
}
pub struct DirResource<'a> {
pub path: Cow<'a, str>
}
impl<'a> Resource for DirResource<'a> {
fn get_type(&self) -> &str { "dir" }
fn get_value(&self) -> &str { &*self.path }
}
pub struct FileResource<'a> {
pub path: Cow<'a, str>
}
impl<'a> Resource for FileResource<'a> {
fn get_type(&self) -> &str { "file" }
fn get_value(&self) -> &str { &*self.path }
}