pub async fn path(self, path: impl AsRef<Path>) -> Result<Self> {
        let target = path.as_ref();

        let reader = tokio::fs::File::open(&target).await?;

        let mime = mime_guess::from_path(&target).first_or_text_plain();
        debug!("guessed mime: {}", mime);

        Ok(self.header(headers::ContentType::from(mime)).reader(reader))
    }
/// Set the body to the content of a file given by a Path
/// Also sets a content type by guessing the mime type from the path name
Set the body to the content of a file given by a Path
Also sets a content type by guessing the mime type from the path name
Set the body to the content of a file given by a Path Also sets a content type by guessing the mime type from the path name
pub async fn path(self, path: impl AsRef<Path>) -> Result<Self> {
        let target = path.as_ref();
        let reader = tokio::fs::File::open(&target).await?;
        let mime = mime_guess::from_path(&target).first_or_text_plain();
        debug!("guessed mime: {}", mime);
        Ok(self.header(headers::ContentType::from(mime)).reader(reader))
    }
pub async fn path ( self , path : impl AsRef < Path > ) -> Result < Self > { let target = path . as_ref ( ) ; let reader = tokio :: fs :: File :: open ( & target ) . await ? ; let mime = mime_guess :: from_path ( & target ) . first_or_text_plain ( ) ; debug ! ( " " mime ) ; Ok ( self . header ( headers :: ContentType :: from ( mime ) ) . reader ( reader ) ) }
Set the body to the content of a file given by a Path
Also sets a content type by guessing the mime type from the path name
Set the body to the content of a file given by a Path Also sets a content type by guessing the mime type from the path name
self
path
impl AsRef<Path>