Skip to content

Commit 01d5003

Browse files
committed
PropertyList.clone() -> PropertyList.copy()
1 parent 64bb63f commit 01d5003

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

hdf5-rs/src/hl/plist.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,6 @@ impl Deref for PropertyList {
4646
}
4747
}
4848

49-
impl Clone for PropertyList {
50-
fn clone(&self) -> Self {
51-
let id = h5call!(H5Pcopy(self.id())).unwrap_or(H5I_INVALID_HID);
52-
Self::from_id(id).ok().unwrap_or_else(Self::invalid)
53-
}
54-
}
55-
5649
impl PartialEq for PropertyList {
5750
fn eq(&self, other: &Self) -> bool {
5851
h5call!(H5Pequal(self.id(), other.id())).unwrap_or(0) == 1
@@ -156,6 +149,11 @@ impl FromStr for PropertyListClass {
156149
}
157150

158151
impl PropertyList {
152+
/// Copies the property list.
153+
pub fn copy(&self) -> Result<Self> {
154+
Self::from_id(h5call!(H5Pcopy(self.id()))?)
155+
}
156+
159157
/// Queries whether a property name exists in the property list.
160158
pub fn has(&self, property: &str) -> bool {
161159
to_cstring(property)
@@ -244,7 +242,7 @@ pub mod tests {
244242
pub fn test_clone() {
245243
let (fapl, _) = make_plists();
246244
assert!(fapl.is_valid());
247-
let fapl_c = fapl.clone();
245+
let fapl_c = fapl.copy().unwrap();
248246
assert!(fapl.is_valid());
249247
assert!(fapl_c.is_valid());
250248
assert_eq!(fapl.refcount(), 1);

0 commit comments

Comments
 (0)