Skip to content

thanadolps/rocket_anyhow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rocket_anyhow

This library provided rocket_anyhow::Error, a wrapper around anyhow::Error with rocket's responder implemented.

use std::io::Write;

#[post("/<path..>", data="<text>")]
fn write_utf8_to(path: std::path::PathBuf, text: Vec<u8>) -> rocket_anyhow::Result {
   let mut file = std::fs::File::open(path)?;
   let text = std::str::from_utf8(&text)?;
   file.write_all(text.as_ref())?;
   Ok(())
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages