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.
24 lines
473 B
24 lines
473 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 }
|
|
}
|