Trait chilli::helpers::PathBound
[−]
[src]
pub trait PathBound { fn open_resource(&self, resource: &str) -> File; }
Path bound trait.
Required Methods
ⓘImportant traits for &'a File
fn open_resource(&self, resource: &str) -> File
Opens a resource from the root path folder. Consider the following folder structure:
ⓘThis example is not tested
/myapp.rs /user.sql /templates /index.html
If you want to open the user.sql
file you should do the following:
use std::io::Read; use sharp_pencil::PathBound; fn main() { let app = sharp_pencil::Pencil::new("/web/demo"); let mut file = app.open_resource("user.sql"); let mut content = String::from(""); file.read_to_string(&mut content).unwrap(); }
Implementors
impl PathBound for Pencil