Add some prerequisites
This commit is contained in:
parent
124b639e50
commit
f3b70607f1
6 changed files with 81 additions and 0 deletions
|
|
@ -1,3 +1,5 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
pub trait Resource {
|
||||
fn get_type(&self) -> &str;
|
||||
fn get_value(&self) -> &str;
|
||||
|
|
@ -11,3 +13,12 @@ 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 }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue