Reduced tokio featureset

This commit is contained in:
Emi Tatsuo 2020-11-19 10:21:32 -05:00
parent e0abe6344b
commit 3da18ca530
Signed by: Emi
GPG key ID: 68FAB2E2E6DFC98B
2 changed files with 6 additions and 3 deletions

View file

@ -10,13 +10,13 @@ documentation = "https://docs.rs/northstar"
[features] [features]
default = ["serve_dir"] default = ["serve_dir"]
serve_dir = ["mime_guess"] serve_dir = ["mime_guess", "tokio/fs"]
[dependencies] [dependencies]
anyhow = "1.0.33" anyhow = "1.0.33"
rustls = { version = "0.18.1", features = ["dangerous_configuration"] } rustls = { version = "0.18.1", features = ["dangerous_configuration"] }
tokio-rustls = "0.20.0" tokio-rustls = "0.20.0"
tokio = { version = "0.3.1", features = ["full"] } tokio = { version = "0.3.1", features = ["io-util","net","time", "rt"] }
mime = "0.3.16" mime = "0.3.16"
uriparse = "0.6.3" uriparse = "0.6.3"
percent-encoding = "2.1.0" percent-encoding = "2.1.0"

View file

@ -1,4 +1,6 @@
use tokio::{io::AsyncRead, fs::File}; use tokio::io::AsyncRead;
#[cfg(feature="serve_dir")]
use tokio::fs::File;
use crate::types::Document; use crate::types::Document;
@ -37,6 +39,7 @@ impl<'a> From<&'a str> for Body {
} }
} }
#[cfg(feature="serve_dir")]
impl From<File> for Body { impl From<File> for Body {
fn from(file: File) -> Self { fn from(file: File) -> Self {
Self::Reader(Box::new(file)) Self::Reader(Box::new(file))