6666//! By default, this crate provides the following implementations:
6767//!
6868//! * Memory: [`InMemory`](memory::InMemory)
69- //! * Local filesystem: [`LocalFileSystem`](local::LocalFileSystem)
7069//!
7170//! Feature flags are used to enable support for other implementations:
7271//!
72+ #"
75+ ) ]
7376#![ cfg_attr(
7477 feature = "gcp" ,
7578 doc = "* [`gcp`]: [Google Cloud Storage](https://cloud.google.com/storage/) support. See [`GoogleCloudStorageBuilder`](gcp::GoogleCloudStorageBuilder)"
@@ -513,7 +516,7 @@ pub mod gcp;
513516#[ cfg( feature = "http" ) ]
514517pub mod http;
515518pub mod limit;
516- #[ cfg( not( target_arch = "wasm32" ) ) ]
519+ #[ cfg( all ( feature = "fs" , not( target_arch = "wasm32" ) ) ) ]
517520pub mod local;
518521pub mod memory;
519522pub mod path;
@@ -557,15 +560,15 @@ pub use upload::*;
557560pub use util:: { coalesce_ranges, collect_bytes, GetRange , OBJECT_STORE_COALESCE_DEFAULT } ;
558561
559562use crate :: path:: Path ;
560- #[ cfg( not( target_arch = "wasm32" ) ) ]
563+ #[ cfg( all ( feature = "fs" , not( target_arch = "wasm32" ) ) ) ]
561564use crate :: util:: maybe_spawn_blocking;
562565use async_trait:: async_trait;
563566use bytes:: Bytes ;
564567use chrono:: { DateTime , Utc } ;
565568use futures:: { stream:: BoxStream , StreamExt , TryStreamExt } ;
566569use snafu:: Snafu ;
567570use std:: fmt:: { Debug , Formatter } ;
568- #[ cfg( not( target_arch = "wasm32" ) ) ]
571+ #[ cfg( all ( feature = "fs" , not( target_arch = "wasm32" ) ) ) ]
569572use std:: io:: { Read , Seek , SeekFrom } ;
570573use std:: ops:: Range ;
571574use std:: sync:: Arc ;
@@ -1028,6 +1031,7 @@ pub struct GetResult {
10281031/// be able to optimise the case of a file already present on local disk
10291032pub enum GetResultPayload {
10301033 /// The file, path
1034+ #[ cfg( all( feature = "fs" , not( target_arch = "wasm32" ) ) ) ]
10311035 File ( std:: fs:: File , std:: path:: PathBuf ) ,
10321036 /// An opaque stream of bytes
10331037 Stream ( BoxStream < ' static , Result < Bytes > > ) ,
@@ -1036,6 +1040,7 @@ pub enum GetResultPayload {
10361040impl Debug for GetResultPayload {
10371041 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
10381042 match self {
1043+ #[ cfg( all( feature = "fs" , not( target_arch = "wasm32" ) ) ) ]
10391044 Self :: File ( _, _) => write ! ( f, "GetResultPayload(File)" ) ,
10401045 Self :: Stream ( _) => write ! ( f, "GetResultPayload(Stream)" ) ,
10411046 }
@@ -1047,7 +1052,7 @@ impl GetResult {
10471052 pub async fn bytes ( self ) -> Result < Bytes > {
10481053 let len = self . range . end - self . range . start ;
10491054 match self . payload {
1050- #[ cfg( not( target_arch = "wasm32" ) ) ]
1055+ #[ cfg( all ( feature = "fs" , not( target_arch = "wasm32" ) ) ) ]
10511056 GetResultPayload :: File ( mut file, path) => {
10521057 maybe_spawn_blocking ( move || {
10531058 file. seek ( SeekFrom :: Start ( self . range . start as _ ) )
@@ -1087,7 +1092,7 @@ impl GetResult {
10871092 /// no additional complexity or overheads
10881093 pub fn into_stream ( self ) -> BoxStream < ' static , Result < Bytes > > {
10891094 match self . payload {
1090- #[ cfg( not( target_arch = "wasm32" ) ) ]
1095+ #[ cfg( all ( feature = "fs" , not( target_arch = "wasm32" ) ) ) ]
10911096 GetResultPayload :: File ( file, path) => {
10921097 const CHUNK_SIZE : usize = 8 * 1024 ;
10931098 local:: chunked_stream ( file, path, self . range , CHUNK_SIZE )
0 commit comments