We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0a02be3 commit cb05c2eCopy full SHA for cb05c2e
src/impl_owned_array.rs
@@ -1,5 +1,29 @@
1
use imp_prelude::*;
2
3
+/// Methods specific to `Array0`.
4
+///
5
+/// ***See also all methods for [`ArrayBase`]***
6
7
+/// [`ArrayBase`]: struct.ArrayBase.html
8
+impl<A> Array<A, Ix0> {
9
+ /// Returns the single element in the array without cloning it.
10
+ ///
11
+ /// ```
12
+ /// use ndarray::{arr0, Array0};
13
14
+ /// // `Foo` doesn't implement `Clone`.
15
+ /// #[derive(Debug, Eq, PartialEq)]
16
+ /// struct Foo;
17
18
+ /// let array: Array0<Foo> = arr0(Foo);
19
+ /// let scalar: Foo = array.into_scalar();
20
+ /// assert_eq!(scalar, Foo);
21
22
+ pub fn into_scalar(mut self) -> A {
23
+ self.data.0.remove(0)
24
+ }
25
+}
26
+
27
/// Methods specific to `Array`.
28
///
29
/// ***See also all methods for [`ArrayBase`]***
0 commit comments