Skip to content

Commit 3625eaf

Browse files
committed
Add docs for Convertable trait
1 parent 4c685d8 commit 3625eaf

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/arith/mod.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,29 @@ binary_func!("Elementwise minimum operation of two Arrays", minof, af_minof);
195195
binary_func!("Elementwise maximum operation of two Arrays", maxof, af_maxof);
196196
binary_func!("Compute length of hypotenuse of two Arrays", hypot, af_hypot);
197197

198+
/// Type Trait to convert to an [Array](./struct.Array.html)
199+
///
200+
/// Generic functions that overload the binary operations such as add, div, mul, rem, ge etc. are
201+
/// bound by this trait to allow combinations of scalar values and Array objects as parameters
202+
/// to those functions.
203+
///
204+
/// Internally, Convertable trait is implemented by following types.
205+
///
206+
/// - f32
207+
/// - f64
208+
/// - num::Complex\<f32\>
209+
/// - num::Complex\<f64\>
210+
/// - bool
211+
/// - i32
212+
/// - u32
213+
/// - u8
214+
/// - i64
215+
/// - u64
216+
/// - i16
217+
/// - u16
218+
///
198219
pub trait Convertable {
220+
/// Get an Array from given type
199221
fn convert(&self) -> Array;
200222
}
201223

0 commit comments

Comments
 (0)