pub trait ArrayCount<T: ArrayElement>{
// Required method
fn count_nonzero(
&self,
axis: Option<isize>,
keepdims: Option<bool>,
) -> Result<Array<usize>, ArrayError>;
}
Expand description
ArrayTrait
- Array Count functions
Required Methods§
Sourcefn count_nonzero(
&self,
axis: Option<isize>,
keepdims: Option<bool>,
) -> Result<Array<usize>, ArrayError>
fn count_nonzero( &self, axis: Option<isize>, keepdims: Option<bool>, ) -> Result<Array<usize>, ArrayError>
Sort an array
§Arguments
axis
- axis along which to count. if None, array is flattenedkeepdims
- if true, the result will broadcast correctly against the input
§Examples
use arr_rs::prelude::*;
let arr = array_eye!(i32, 4);
assert_eq!(array!(usize, [4]), arr.count_nonzero(None, None));
let arr = array!(i32, [[0, 1, 7, 0], [3, 0, 2, 19]]);
assert_eq!(array!(usize, [1, 1, 2, 1]), arr.count_nonzero(Some(0), None));
§Errors
may returns ArrayError
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.