File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright 2019 ndarray developers.
2+ //
3+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6+ // option. This file may not be copied, modified, or distributed
7+ // except according to those terms.
8+
9+ use crate :: imp_prelude:: * ;
10+ use alloc:: sync:: Arc ;
11+
12+ /// Methods specific to `ArcArray`.
13+ ///
14+ /// ***See also all methods for [`ArrayBase`]***
15+ impl < A , D > ArcArray < A , D >
16+ where D : Dimension
17+ {
18+ /// Returns `true` iff the inner `Arc` is not shared.
19+ /// If you want to ensure the `Arc` is not concurrently cloned, you need to provide a `&mut self` to this function.
20+ pub fn is_unique ( & self ) -> bool
21+ {
22+ // Only strong pointers are used in this crate.
23+ Arc :: strong_count ( & self . data . 0 ) == 1
24+ }
25+ }
Original file line number Diff line number Diff line change @@ -1612,6 +1612,9 @@ mod impl_raw_views;
16121612// Copy-on-write array methods
16131613mod impl_cow;
16141614
1615+ // Arc array methods
1616+ mod impl_arc_array;
1617+
16151618/// Returns `true` if the pointer is aligned.
16161619pub ( crate ) fn is_aligned < T > ( ptr : * const T ) -> bool
16171620{
You can’t perform that action at this time.
0 commit comments