@@ -35,10 +35,12 @@ use crate::error::{AsyncTiffError, AsyncTiffResult};
35
35
#[ cfg_attr( not( target_arch = "wasm32" ) , async_trait) ]
36
36
pub trait AsyncFileReader : Debug + Send + Sync {
37
37
/// Retrieve the bytes in `range`
38
+ /// This function is called when reading in IFDs
38
39
async fn get_bytes ( & self , range : Range < u64 > ) -> AsyncTiffResult < Bytes > ;
39
40
40
41
/// Retrieve multiple byte ranges. The default implementation will call `get_bytes`
41
42
/// sequentially
43
+ /// This function is called when reading in IFDs
42
44
async fn get_byte_ranges ( & self , ranges : Vec < Range < u64 > > ) -> AsyncTiffResult < Vec < Bytes > > {
43
45
let mut result = Vec :: with_capacity ( ranges. len ( ) ) ;
44
46
@@ -49,6 +51,18 @@ pub trait AsyncFileReader: Debug + Send + Sync {
49
51
50
52
Ok ( result)
51
53
}
54
+
55
+ /// Same as [`get_bytes`], but this function is called when retrieving
56
+ /// compressed tile data
57
+ async fn get_tile_bytes ( & self , range : Range < u64 > ) -> AsyncTiffResult < Bytes > {
58
+ self . get_bytes ( range) . await
59
+ }
60
+
61
+ /// Same as [`get_byte_ranges`], but this function is only called when retrieving
62
+ /// compressed tile data
63
+ async fn get_tile_byte_ranges ( & self , ranges : Vec < Range < u64 > > ) -> AsyncTiffResult < Vec < Bytes > > {
64
+ self . get_byte_ranges ( ranges) . await
65
+ }
52
66
}
53
67
54
68
/// This allows Box<dyn AsyncFileReader + '_> to be used as an AsyncFileReader,
0 commit comments