Skip to content

Commit 8adf5d8

Browse files
authored
Revert #1563 and #1567 to prepare for patch release (#1570)
Both #1563 and #1567 were done in preparation for new code to address #1506. However, those PRs introduce deprecations, which will require a minor version bump to adhere to SemVer. Instead of having them on master, we have created the refactor branch where they will continue to live.
1 parent 953f2e9 commit 8adf5d8

File tree

13 files changed

+312
-313
lines changed

13 files changed

+312
-313
lines changed

src/indexes.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::dimension::IntoDimension;
1010
use crate::split_at::SplitAt;
1111
use crate::zip::Offset;
1212
use crate::Axis;
13-
use crate::LayoutBitset;
13+
use crate::Layout;
1414
use crate::NdProducer;
1515
use crate::{ArrayBase, Data};
1616

@@ -193,12 +193,12 @@ impl<D: Dimension + Copy> NdProducer for Indices<D>
193193
IndexPtr { index: self.start }
194194
}
195195

196-
fn layout(&self) -> LayoutBitset
196+
fn layout(&self) -> Layout
197197
{
198198
if self.dim.ndim() <= 1 {
199-
LayoutBitset::one_dimensional()
199+
Layout::one_dimensional()
200200
} else {
201-
LayoutBitset::none()
201+
Layout::none()
202202
}
203203
}
204204

src/iterators/chunks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::marker::PhantomData;
33
use crate::imp_prelude::*;
44
use crate::Baseiter;
55
use crate::IntoDimension;
6-
use crate::{LayoutBitset, NdProducer};
6+
use crate::{Layout, NdProducer};
77

88
impl_ndproducer! {
99
['a, A, D: Dimension]

src/iterators/lanes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::marker::PhantomData;
33
use super::LanesIter;
44
use super::LanesIterMut;
55
use crate::imp_prelude::*;
6-
use crate::{LayoutBitset, NdProducer};
6+
use crate::{Layout, NdProducer};
77

88
impl_ndproducer! {
99
['a, A, D: Dimension]

src/iterators/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<$($typarm)*> NdProducer for $fulltype {
6767
self.$base.raw_dim()
6868
}
6969

70-
fn layout(&self) -> LayoutBitset {
70+
fn layout(&self) -> Layout {
7171
self.$base.layout()
7272
}
7373

src/iterators/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,9 +1191,9 @@ impl<A, D: Dimension> NdProducer for AxisIter<'_, A, D>
11911191
type Ptr = *mut A;
11921192
type Stride = isize;
11931193

1194-
fn layout(&self) -> crate::LayoutBitset
1194+
fn layout(&self) -> crate::Layout
11951195
{
1196-
crate::LayoutBitset::one_dimensional()
1196+
crate::Layout::one_dimensional()
11971197
}
11981198

11991199
fn raw_dim(&self) -> Self::Dim
@@ -1250,9 +1250,9 @@ impl<A, D: Dimension> NdProducer for AxisIterMut<'_, A, D>
12501250
type Ptr = *mut A;
12511251
type Stride = isize;
12521252

1253-
fn layout(&self) -> crate::LayoutBitset
1253+
fn layout(&self) -> crate::Layout
12541254
{
1255-
crate::LayoutBitset::one_dimensional()
1255+
crate::Layout::one_dimensional()
12561256
}
12571257

12581258
fn raw_dim(&self) -> Self::Dim

src/iterators/windows.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::marker::PhantomData;
33
use super::Baseiter;
44
use crate::imp_prelude::*;
55
use crate::IntoDimension;
6-
use crate::LayoutBitset;
6+
use crate::Layout;
77
use crate::NdProducer;
88
use crate::Slice;
99

@@ -176,7 +176,7 @@ impl<'a, A, D: Dimension> NdProducer for AxisWindows<'a, A, D>
176176
Ix1(self.base.raw_dim()[self.axis_idx])
177177
}
178178

179-
fn layout(&self) -> LayoutBitset
179+
fn layout(&self) -> Layout
180180
{
181181
self.base.layout()
182182
}

src/layout/bitset.rs

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

src/layout/layoutfmt.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2017 bluss and 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 super::Layout;
10+
11+
const LAYOUT_NAMES: &[&str] = &["C", "F", "c", "f"];
12+
13+
use std::fmt;
14+
15+
impl fmt::Debug for Layout
16+
{
17+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
18+
{
19+
if self.0 == 0 {
20+
write!(f, "Custom")?
21+
} else {
22+
(0..32).filter(|&i| self.is(1 << i)).try_fold((), |_, i| {
23+
if let Some(name) = LAYOUT_NAMES.get(i) {
24+
write!(f, "{}", name)
25+
} else {
26+
write!(f, "{:#x}", i)
27+
}
28+
})?;
29+
};
30+
write!(f, " ({:#x})", self.0)
31+
}
32+
}

0 commit comments

Comments
 (0)