Skip to content

Commit 986c28d

Browse files
committed
Revert rust-ndarray#1567 to prepare for a patch release.
This reverts commit 953f2e9. The commit will now live on the `refactor` branch until more of the new layout code is ready
1 parent 953f2e9 commit 986c28d

3 files changed

Lines changed: 279 additions & 274 deletions

File tree

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::LayoutBitset;
10+
11+
const LAYOUT_NAMES: &[&str] = &["C", "F", "c", "f"];
12+
13+
use std::fmt;
14+
15+
impl fmt::Debug for LayoutBitset
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)