@@ -357,7 +357,7 @@ impl Body {
357
357
/// res.set_body(Body::from_file("/path/to/file").await?);
358
358
/// # Ok(()) }) }
359
359
/// ```
360
- #[ cfg( all( feature = "async_std " , not( target_os = "unknown" ) ) ) ]
360
+ #[ cfg( all( feature = "fs " , not( target_os = "unknown" ) ) ) ]
361
361
pub async fn from_file < P > ( path : P ) -> io:: Result < Self >
362
362
where
363
363
P : AsRef < std:: path:: Path > ,
@@ -477,7 +477,7 @@ impl AsyncBufRead for Body {
477
477
478
478
/// Look at first few bytes of a file to determine the mime type.
479
479
/// This is used for various binary formats such as images and videos.
480
- #[ cfg( all( feature = "async_std " , not( target_os = "unknown" ) ) ) ]
480
+ #[ cfg( all( feature = "fs " , not( target_os = "unknown" ) ) ) ]
481
481
async fn peek_mime ( file : & mut async_std:: fs:: File ) -> io:: Result < Option < Mime > > {
482
482
// We need to read the first 300 bytes to correctly infer formats such as tar.
483
483
let mut buf = [ 0_u8 ; 300 ] ;
@@ -491,7 +491,7 @@ async fn peek_mime(file: &mut async_std::fs::File) -> io::Result<Option<Mime>> {
491
491
492
492
/// Look at the extension of a file to determine the mime type.
493
493
/// This is useful for plain-text formats such as HTML and CSS.
494
- #[ cfg( all( feature = "async_std " , not( target_os = "unknown" ) ) ) ]
494
+ #[ cfg( all( feature = "fs " , not( target_os = "unknown" ) ) ) ]
495
495
fn guess_ext ( path : & std:: path:: Path ) -> Option < Mime > {
496
496
let ext = path. extension ( ) . map ( |p| p. to_str ( ) ) . flatten ( ) ;
497
497
ext. and_then ( Mime :: from_extension)
0 commit comments