Skip to content

Commit ec6aead

Browse files
committed
Change argument names of link functions
1 parent 615a8d3 commit ec6aead

File tree

1 file changed

+34
-22
lines changed

1 file changed

+34
-22
lines changed

src/hl/group.rs

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -102,28 +102,37 @@ impl Group {
102102
Self::from_id(h5try!(H5Gopen2(self.id(), name.as_ptr(), H5P_DEFAULT)))
103103
}
104104

105-
/// Creates a soft link. Note: `src` and `dst` are relative to the current object.
106-
pub fn link_soft(&self, src: &str, dst: &str) -> Result<()> {
105+
/// Creates a soft link.
106+
///
107+
/// A soft link does not require the linked object to exist.
108+
/// Note: `target` and `link_name` are relative to the current object.
109+
pub fn link_soft(&self, target: &str, link_name: &str) -> Result<()> {
107110
// TODO: &mut self?
108111
h5lock!({
109112
let lcpl = make_lcpl()?;
110-
let src = to_cstring(src)?;
111-
let dst = to_cstring(dst)?;
112-
h5call!(H5Lcreate_soft(src.as_ptr(), self.id(), dst.as_ptr(), lcpl.id(), H5P_DEFAULT))
113-
.and(Ok(()))
113+
let target = to_cstring(target)?;
114+
let link_name = to_cstring(link_name)?;
115+
h5call!(H5Lcreate_soft(
116+
target.as_ptr(),
117+
self.id(),
118+
link_name.as_ptr(),
119+
lcpl.id(),
120+
H5P_DEFAULT
121+
))
122+
.and(Ok(()))
114123
})
115124
}
116125

117-
/// Creates a hard link. Note: `src` and `dst` are relative to the current object.
118-
pub fn link_hard(&self, src: &str, dst: &str) -> Result<()> {
126+
/// Creates a hard link. Note: `target` and `link_name` are relative to the current object.
127+
pub fn link_hard(&self, target: &str, link_name: &str) -> Result<()> {
119128
// TODO: &mut self?
120-
let src = to_cstring(src)?;
121-
let dst = to_cstring(dst)?;
129+
let target = to_cstring(target)?;
130+
let link_name = to_cstring(link_name)?;
122131
h5call!(H5Lcreate_hard(
123132
self.id(),
124-
src.as_ptr(),
133+
target.as_ptr(),
125134
H5L_SAME_LOC,
126-
dst.as_ptr(),
135+
link_name.as_ptr(),
127136
H5P_DEFAULT,
128137
H5P_DEFAULT
129138
))
@@ -132,21 +141,24 @@ impl Group {
132141

133142
/// Creates an external link.
134143
///
135-
/// Note: `dst` is relative to the current object, `src` is relative to the root of the source file,
136-
/// `src_file_path` is the path to the external file.
144+
/// Note: `link_name` is relative to the current object,
145+
/// `target` is relative to the root of the source file,
146+
/// `target_file_name` is the path to the external file.
137147
///
138-
/// For a detailed explanation on how `src_file_path` is resolved, see
148+
/// For a detailed explanation on how `target_file_name` is resolved, see
139149
/// [https://portal.hdfgroup.org/display/HDF5/H5L_CREATE_EXTERNAL](https://portal.hdfgroup.org/display/HDF5/H5L_CREATE_EXTERNAL)
140-
pub fn link_external(&self, src_file_path: &str, src: &str, dst: &str) -> Result<()> {
150+
pub fn link_external(
151+
&self, target_file_name: &str, target: &str, link_name: &str,
152+
) -> Result<()> {
141153
// TODO: &mut self?
142-
let src = to_cstring(src)?;
143-
let src_file_name = to_cstring(src_file_path)?;
144-
let dst = to_cstring(dst)?;
154+
let target = to_cstring(target)?;
155+
let target_file_name = to_cstring(target_file_name)?;
156+
let link_name = to_cstring(link_name)?;
145157
h5call!(H5Lcreate_external(
146-
src_file_name.as_ptr(),
147-
src.as_ptr(),
158+
target_file_name.as_ptr(),
159+
target.as_ptr(),
148160
self.id(),
149-
dst.as_ptr(),
161+
link_name.as_ptr(),
150162
H5P_DEFAULT,
151163
H5P_DEFAULT,
152164
))

0 commit comments

Comments
 (0)