Skip to content

Commit 5a78268

Browse files
committed
Allow deprecated set_comment (with warning)
1 parent f463980 commit 5a78268

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/hl/location.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ use std::fmt::{self, Debug};
22
use std::ops::Deref;
33
use std::ptr;
44

5+
#[allow(deprecated)]
6+
use hdf5_sys::h5o::H5Oset_comment;
57
use hdf5_sys::{
68
h5a::H5Aopen,
79
h5f::H5Fget_name,
810
h5i::{H5Iget_file_id, H5Iget_name},
9-
h5o::{H5Oget_comment, H5Oset_comment},
11+
h5o::H5Oget_comment,
1012
};
1113

1214
use crate::internal_prelude::*;
@@ -77,15 +79,19 @@ impl Location {
7779
}
7880

7981
/// Set or the commment attached to the named object.
82+
#[deprecated(note = "Attributes are preferred to comments")]
8083
pub fn set_comment(&self, comment: &str) -> Result<()> {
8184
// TODO: &mut self?
8285
let comment = to_cstring(comment)?;
86+
#[allow(deprecated)]
8387
h5call!(H5Oset_comment(self.id(), comment.as_ptr())).and(Ok(()))
8488
}
8589

8690
/// Clear the commment attached to the named object.
91+
#[deprecated(note = "Attributes are preferred to comments")]
8792
pub fn clear_comment(&self) -> Result<()> {
8893
// TODO: &mut self?
94+
#[allow(deprecated)]
8995
h5call!(H5Oset_comment(self.id(), ptr::null_mut())).and(Ok(()))
9096
}
9197

@@ -134,6 +140,7 @@ pub mod tests {
134140

135141
#[test]
136142
pub fn test_comment() {
143+
#[allow(deprecated)]
137144
with_tmp_file(|file| {
138145
assert!(file.comment().is_none());
139146
assert!(file.set_comment("foo").is_ok());

0 commit comments

Comments
 (0)