@@ -8,17 +8,17 @@ use hdf5_sys::h5d::{H5Dget_chunk_info, H5Dget_num_chunks};
8
8
pub struct ChunkInfo {
9
9
/// Array with a size equal to the dataset’s rank whose elements contain 0-based
10
10
/// logical positions of the chunk’s first element in each dimension.
11
- pub offset : Vec < u64 > ,
11
+ pub offset : Vec < hsize_t > ,
12
12
/// Filter mask that indicates which filters were used with the chunk when written.
13
13
///
14
14
/// A zero value indicates that all enabled filters are applied on the chunk.
15
15
/// A filter is skipped if the bit corresponding to the filter’s position in
16
16
/// the pipeline (0 ≤ position < 32) is turned on.
17
17
pub filter_mask : u32 ,
18
18
/// Chunk address in the file.
19
- pub addr : u64 ,
19
+ pub addr : haddr_t ,
20
20
/// Chunk size in bytes.
21
- pub size : u64 ,
21
+ pub size : hsize_t ,
22
22
}
23
23
24
24
#[ cfg( feature = "1.10.5" ) ]
@@ -67,28 +67,28 @@ pub(crate) fn get_num_chunks(ds: &Dataset) -> Option<usize> {
67
67
}
68
68
69
69
#[ cfg( feature = "1.14.0" ) ]
70
- mod one_thirteen {
70
+ mod v1_14_0 {
71
71
use super :: * ;
72
72
use hdf5_sys:: h5d:: H5Dchunk_iter ;
73
73
74
74
/// Borrowed version of [ChunkInfo](crate::dataset::ChunkInfo)
75
75
#[ derive( Clone , Debug , PartialEq , Eq ) ]
76
76
pub struct ChunkInfoRef < ' a > {
77
- pub offset : & ' a [ u64 ] ,
77
+ pub offset : & ' a [ hsize_t ] ,
78
78
pub filter_mask : u32 ,
79
- pub addr : u64 ,
80
- pub size : u64 ,
79
+ pub addr : haddr_t ,
80
+ pub size : hsize_t ,
81
81
}
82
82
83
- impl < ' a > ChunkInfoBorrowed < ' a > {
83
+ impl < ' a > ChunkInfoRef < ' a > {
84
84
/// Returns positional indices of disabled filters.
85
85
pub fn disabled_filters ( & self ) -> Vec < usize > {
86
86
( 0 ..32 ) . filter ( |i| self . filter_mask & ( 1 << i) != 0 ) . collect ( )
87
87
}
88
88
}
89
89
90
- impl < ' a > From < ChunkInfoBorrowed < ' a > > for ChunkInfo {
91
- fn from ( val : ChunkInfoBorrowed < ' a > ) -> Self {
90
+ impl < ' a > From < ChunkInfoRef < ' a > > for ChunkInfo {
91
+ fn from ( val : ChunkInfoRef < ' a > ) -> Self {
92
92
Self {
93
93
offset : val. offset . to_owned ( ) ,
94
94
filter_mask : val. filter_mask ,
@@ -109,18 +109,17 @@ mod one_thirteen {
109
109
op_data : * mut c_void ,
110
110
) -> herr_t
111
111
where
112
- F : FnMut ( ChunkInfoBorrowed ) -> i32 ,
112
+ F : FnMut ( ChunkInfoRef ) -> i32 ,
113
113
{
114
114
unsafe {
115
115
std:: panic:: catch_unwind ( || {
116
116
let data: * mut RustCallback < F > = op_data. cast :: < RustCallback < F > > ( ) ;
117
117
let ndims = ( * data) . ndims ;
118
118
let callback = & mut ( * data) . callback ;
119
119
120
- let offset = std:: slice:: from_raw_parts ( offset, ndims) ;
120
+ let offset = std:: slice:: from_raw_parts ( offset, ndims as usize ) ;
121
121
122
- let info =
123
- ChunkInfoBorrowed { offset, filter_mask, addr : addr as u64 , size : size as u64 } ;
122
+ let info = ChunkInfoRef { offset, filter_mask, addr, size } ;
124
123
125
124
callback ( info)
126
125
} )
@@ -130,9 +129,9 @@ mod one_thirteen {
130
129
131
130
pub ( crate ) fn visit < F > ( ds : & Dataset , callback : F ) -> Result < ( ) >
132
131
where
133
- F : for < ' a > FnMut ( ChunkInfoBorrowed < ' a > ) -> i32 ,
132
+ F : for < ' a > FnMut ( ChunkInfoRef < ' a > ) -> i32 ,
134
133
{
135
- let mut data = RustCallback :: < F > { ndims : ds. ndim ( ) , callback } ;
134
+ let mut data = RustCallback :: < F > { ndims : ds. ndim ( ) as _ , callback } ;
136
135
137
136
h5try ! ( H5Dchunk_iter (
138
137
ds. id( ) ,
@@ -159,7 +158,7 @@ mod one_thirteen {
159
158
ds. write ( & ndarray:: arr2 ( & [ [ 1 , 2 ] , [ 3 , 4 ] , [ 5 , 6 ] ] ) ) . unwrap ( ) ;
160
159
161
160
let mut i = 0 ;
162
- let f = |c : ChunkInfoBorrowed | {
161
+ let f = |c : ChunkInfoRef | {
163
162
match i {
164
163
0 => assert_eq ! ( c. offset, [ 0 , 0 ] ) ,
165
164
1 => assert_eq ! ( c. offset, [ 0 , 1 ] ) ,
@@ -179,5 +178,5 @@ mod one_thirteen {
179
178
}
180
179
}
181
180
}
182
- #[ cfg( feature = "1.13 .0" ) ]
183
- pub use one_thirteen :: * ;
181
+ #[ cfg( feature = "1.14 .0" ) ]
182
+ pub use v1_14_0 :: * ;
0 commit comments