@@ -23,7 +23,7 @@ use libhdf5_sys::h5ac::{
2323 H5AC__MAX_TRACE_FILE_NAME_LEN ,
2424} ;
2525use libhdf5_sys:: h5c:: { H5C_cache_decr_mode , H5C_cache_flash_incr_mode , H5C_cache_incr_mode } ;
26- use libhdf5_sys:: h5f:: { H5F_close_degree_t , H5F_libver_t , H5F_mem_t , H5F_FAMILY_DEFAULT } ;
26+ use libhdf5_sys:: h5f:: { H5F_close_degree_t , H5F_mem_t , H5F_FAMILY_DEFAULT } ;
2727use libhdf5_sys:: h5fd:: H5FD_MEM_NTYPES ;
2828use libhdf5_sys:: h5fd:: {
2929 H5FD_LOG_ALL , H5FD_LOG_FILE_IO , H5FD_LOG_FILE_READ , H5FD_LOG_FILE_WRITE , H5FD_LOG_FLAVOR ,
@@ -35,12 +35,12 @@ use libhdf5_sys::h5fd::{
3535} ;
3636use libhdf5_sys:: h5p:: {
3737 H5Pcreate , H5Pget_alignment , H5Pget_cache , H5Pget_driver , H5Pget_fapl_core , H5Pget_fapl_family ,
38- H5Pget_fapl_multi , H5Pget_fclose_degree , H5Pget_gc_references , H5Pget_libver_bounds ,
39- H5Pget_mdc_config , H5Pget_meta_block_size , H5Pget_sieve_buf_size , H5Pget_small_data_block_size ,
40- H5Pset_alignment , H5Pset_cache , H5Pset_fapl_core , H5Pset_fapl_family , H5Pset_fapl_log ,
41- H5Pset_fapl_multi , H5Pset_fapl_sec2 , H5Pset_fapl_split , H5Pset_fapl_stdio ,
42- H5Pset_fclose_degree , H5Pset_gc_references , H5Pset_libver_bounds , H5Pset_mdc_config ,
43- H5Pset_meta_block_size , H5Pset_sieve_buf_size , H5Pset_small_data_block_size ,
38+ H5Pget_fapl_multi , H5Pget_fclose_degree , H5Pget_gc_references , H5Pget_mdc_config ,
39+ H5Pget_meta_block_size , H5Pget_sieve_buf_size , H5Pget_small_data_block_size , H5Pset_alignment ,
40+ H5Pset_cache , H5Pset_fapl_core , H5Pset_fapl_family , H5Pset_fapl_log , H5Pset_fapl_multi ,
41+ H5Pset_fapl_sec2 , H5Pset_fapl_split , H5Pset_fapl_stdio , H5Pset_fclose_degree ,
42+ H5Pset_gc_references , H5Pset_mdc_config , H5Pset_meta_block_size , H5Pset_sieve_buf_size ,
43+ H5Pset_small_data_block_size ,
4444} ;
4545#[ cfg( h5_have_direct) ]
4646use libhdf5_sys:: h5p:: { H5Pget_fapl_direct , H5Pset_fapl_direct } ;
@@ -49,6 +49,8 @@ use libhdf5_sys::h5p::{H5Pget_fapl_mpio, H5Pset_fapl_mpio};
4949
5050#[ cfg( hdf5_1_10_1) ]
5151use libhdf5_sys:: h5ac:: { H5AC_cache_image_config_t , H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE } ;
52+ #[ cfg( hdf5_1_10_2) ]
53+ use libhdf5_sys:: h5f:: H5F_libver_t ;
5254#[ cfg( all( hdf5_1_10_0, h5_have_parallel) ) ]
5355use libhdf5_sys:: h5p:: {
5456 H5Pget_all_coll_metadata_ops , H5Pget_coll_metadata_write , H5Pset_all_coll_metadata_ops ,
@@ -63,6 +65,8 @@ use libhdf5_sys::h5p::{
6365 H5Pget_evict_on_close , H5Pget_mdc_image_config , H5Pget_page_buffer_size , H5Pset_evict_on_close ,
6466 H5Pset_mdc_image_config , H5Pset_page_buffer_size ,
6567} ;
68+ #[ cfg( hdf5_1_10_2) ]
69+ use libhdf5_sys:: h5p:: { H5Pget_libver_bounds , H5Pset_libver_bounds } ;
6670#[ cfg( hdf5_1_10_0) ]
6771use libhdf5_sys:: h5p:: {
6872 H5Pget_mdc_log_options , H5Pget_metadata_read_attempts , H5Pset_mdc_log_options ,
@@ -112,7 +116,10 @@ impl Debug for FileAccess {
112116 formatter. field ( "fclose_degree" , & self . fclose_degree ( ) ) ;
113117 formatter. field ( "gc_references" , & self . gc_references ( ) ) ;
114118 formatter. field ( "small_data_block_size" , & self . small_data_block_size ( ) ) ;
115- formatter. field ( "libver_bounds" , & self . libver_bounds ( ) ) ;
119+ #[ cfg( hdf5_1_10_2) ]
120+ {
121+ formatter. field ( "libver_bounds" , & self . libver_bounds ( ) ) ;
122+ }
116123 #[ cfg( hdf5_1_8_7) ]
117124 {
118125 formatter. field ( "elink_file_cache_size" , & self . elink_file_cache_size ( ) ) ;
@@ -881,63 +888,65 @@ impl Default for CacheLogOptions {
881888 }
882889}
883890
884- #[ derive( Clone , Copy , Debug , PartialEq , Eq , PartialOrd , Ord ) ]
885- pub enum LibraryVersion {
886- Earliest = 0 ,
887- V18 = 1 ,
888- V110 = 2 ,
889- }
891+ #[ cfg( hdf5_1_10_2) ]
892+ mod libver {
893+ use super :: * ;
890894
891- impl LibraryVersion {
892- pub fn is_earliest ( self ) -> bool {
893- self == LibraryVersion :: Earliest
895+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , PartialOrd , Ord ) ]
896+ pub enum LibraryVersion {
897+ Earliest = 0 ,
898+ V18 = 1 ,
899+ V110 = 2 ,
894900 }
895901
896- pub fn latest ( ) -> Self {
897- if cfg ! ( hdf5_1_10_0) {
902+ impl LibraryVersion {
903+ pub fn is_earliest ( self ) -> bool {
904+ self == LibraryVersion :: Earliest
905+ }
906+
907+ pub const fn latest ( ) -> Self {
898908 LibraryVersion :: V110
899- } else {
900- LibraryVersion :: V18
901909 }
902910 }
903- }
904911
905- impl Into < H5F_libver_t > for LibraryVersion {
906- fn into ( self ) -> H5F_libver_t {
907- use self :: { H5F_libver_t :: * , LibraryVersion :: * } ;
908- match self {
909- V18 => H5F_LIBVER_V18 ,
910- V110 => H5F_LIBVER_V110 ,
911- _ => H5F_LIBVER_EARLIEST ,
912+ impl Into < H5F_libver_t > for LibraryVersion {
913+ fn into ( self ) -> H5F_libver_t {
914+ use self :: { H5F_libver_t :: * , LibraryVersion :: * } ;
915+ match self {
916+ V18 => H5F_LIBVER_V18 ,
917+ V110 => H5F_LIBVER_V110 ,
918+ _ => H5F_LIBVER_EARLIEST ,
919+ }
912920 }
913921 }
914- }
915922
916- impl From < H5F_libver_t > for LibraryVersion {
917- fn from ( libver : H5F_libver_t ) -> Self {
918- use self :: { H5F_libver_t :: * , LibraryVersion :: * } ;
919- match libver {
920- H5F_LIBVER_V18 => V18 ,
921- H5F_LIBVER_V110 => V110 ,
922- _ => Earliest ,
923+ impl From < H5F_libver_t > for LibraryVersion {
924+ fn from ( libver : H5F_libver_t ) -> Self {
925+ use self :: { H5F_libver_t :: * , LibraryVersion :: * } ;
926+ match libver {
927+ H5F_LIBVER_V18 => V18 ,
928+ H5F_LIBVER_V110 => V110 ,
929+ _ => Earliest ,
930+ }
923931 }
924932 }
925- }
926933
927- #[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
928- pub struct LibVerBounds {
929- pub low : LibraryVersion ,
930- pub high : LibraryVersion ,
931- }
934+ #[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
935+ pub struct LibVerBounds {
936+ pub low : LibraryVersion ,
937+ pub high : LibraryVersion ,
938+ }
932939
933- impl Default for LibVerBounds {
934- fn default ( ) -> Self {
935- let low = LibraryVersion :: Earliest ;
936- let high = if cfg ! ( hdf5_1_10_0) { LibraryVersion :: V110 } else { LibraryVersion :: V18 } ;
937- Self { low, high }
940+ impl Default for LibVerBounds {
941+ fn default ( ) -> Self {
942+ Self { low : LibraryVersion :: Earliest , high : LibraryVersion :: latest ( ) }
943+ }
938944 }
939945}
940946
947+ #[ cfg( hdf5_1_10_2) ]
948+ pub use self :: libver:: * ;
949+
941950/// Builder used to create file access property list.
942951#[ derive( Clone , Debug , Default ) ]
943952pub struct FileAccessBuilder {
@@ -969,7 +978,8 @@ pub struct FileAccessBuilder {
969978 coll_metadata_write : Option < bool > ,
970979 gc_references : Option < bool > ,
971980 small_data_block_size : Option < u64 > ,
972- libver_low_earliest : Option < bool > ,
981+ #[ cfg( hdf5_1_10_2) ]
982+ libver_bounds : Option < LibVerBounds > ,
973983}
974984
975985impl FileAccessBuilder {
@@ -990,7 +1000,11 @@ impl FileAccessBuilder {
9901000 builder. driver ( & drv) ;
9911001 builder. gc_references ( plist. get_gc_references ( ) ?) ;
9921002 builder. small_data_block_size ( plist. get_small_data_block_size ( ) ?) ;
993- builder. libver_bounds ( plist. get_libver_bounds ( ) ?. low . is_earliest ( ) ) ;
1003+ #[ cfg( hdf5_1_10_2) ]
1004+ {
1005+ let v = plist. get_libver_bounds ( ) ?;
1006+ builder. libver_bounds ( v. low , v. high ) ;
1007+ }
9941008 #[ cfg( hdf5_1_8_7) ]
9951009 {
9961010 builder. elink_file_cache_size ( plist. get_elink_file_cache_size ( ) ?) ;
@@ -1122,8 +1136,9 @@ impl FileAccessBuilder {
11221136 self
11231137 }
11241138
1125- pub fn libver_bounds ( & mut self , low_earliest : bool ) -> & mut Self {
1126- self . libver_low_earliest = Some ( low_earliest) ;
1139+ #[ cfg( hdf5_1_10_2) ]
1140+ pub fn libver_bounds ( & mut self , low : LibraryVersion , high : LibraryVersion ) -> & mut Self {
1141+ self . libver_bounds = Some ( LibVerBounds { low, high } ) ;
11271142 self
11281143 }
11291144
@@ -1377,10 +1392,11 @@ impl FileAccessBuilder {
13771392 if let Some ( v) = self . small_data_block_size {
13781393 h5try ! ( H5Pset_small_data_block_size ( id, v as _) ) ;
13791394 }
1380- if let Some ( v) = self . libver_low_earliest {
1381- let high = LibraryVersion :: latest ( ) ;
1382- let low = if v { LibraryVersion :: Earliest } else { high } ;
1383- h5try ! ( H5Pset_libver_bounds ( id, low. into( ) , high. into( ) ) ) ;
1395+ #[ cfg( hdf5_1_10_2) ]
1396+ {
1397+ if let Some ( v) = self . libver_bounds {
1398+ h5try ! ( H5Pset_libver_bounds ( id, v. low. into( ) , v. high. into( ) ) ) ;
1399+ }
13841400 }
13851401 #[ cfg( hdf5_1_8_7) ]
13861402 {
@@ -1788,12 +1804,14 @@ impl FileAccess {
17881804 self . get_small_data_block_size ( ) . unwrap_or ( 2048 )
17891805 }
17901806
1807+ #[ cfg( hdf5_1_10_2) ]
17911808 #[ doc( hidden) ]
17921809 pub fn get_libver_bounds ( & self ) -> Result < LibVerBounds > {
17931810 h5get ! ( H5Pget_libver_bounds ( self . id( ) ) : H5F_libver_t , H5F_libver_t )
17941811 . map ( |( low, high) | LibVerBounds { low : low. into ( ) , high : high. into ( ) } )
17951812 }
17961813
1814+ #[ cfg( hdf5_1_10_2) ]
17971815 pub fn libver_bounds ( & self ) -> LibVerBounds {
17981816 self . get_libver_bounds ( ) . ok ( ) . unwrap_or_else ( LibVerBounds :: default)
17991817 }
0 commit comments