Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5e052ac

Browse files
committed
Added copy method for Array struct that performs a deep copy
1 parent 35cc4ca commit 5e052ac

File tree

3 files changed

+13
-29
lines changed

3 files changed

+13
-29
lines changed

‎src/array.rs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ extern {
5757

5858
fn af_retain_array(out: MutAfArray, arr: AfArray) -> c_int;
5959

60+
fn af_copy_array(out: MutAfArray, arr: AfArray) -> c_int;
61+
6062
fn af_release_array(arr: AfArray) -> c_int;
6163

6264
fn af_print_array(arr: AfArray) -> c_int;
@@ -171,6 +173,17 @@ impl Array {
171173
}
172174
}
173175

176+
pub fn copy(&self) -> Result<Array, AfError> {
177+
unsafe {
178+
let mut temp: i64 = 0;
179+
let err_val = af_copy_array(&mut temp as MutAfArray, self.handle as AfArray);
180+
match err_val {
181+
0 => Ok(Array::from(temp)),
182+
_ => Err(AfError::from(err_val)),
183+
}
184+
}
185+
}
186+
174187
is_func!(is_empty, af_is_empty);
175188
is_func!(is_scalar, af_is_scalar);
176189
is_func!(is_row, af_is_row);

‎src/graphics.rs‎

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎src/lib.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ mod defines;
4040
pub use dim4::Dim4;
4141
mod dim4;
4242

43-
pub use graphics::Window;
44-
mod graphics;
45-
4643
pub use image::{gaussian_kernel, load_image, save_image};
4744
pub use image::{resize, transform, rotate, translate, scale, skew};
4845
pub use image::{dilate, dilate3, erode, erode3, minfilt, maxfilt};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /