Skip to content

Commit 7b435cc

Browse files
committed
move to no_std
1 parent 554d85c commit 7b435cc

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

src/layer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1919
// THE SOFTWARE. }}}
2020

21-
use super::{Cell, CellRepr, CountOnes};
21+
use super::{Cell, CellRepr, CountOnes, std::vec::Vec};
2222

2323
/// A [Layer] is a collection of [Cell]s.
2424
///

src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#![deny(unused_qualifications)]
2727
#![deny(rustdoc::broken_intra_doc_links)]
2828
#![deny(rustdoc::private_intra_doc_links)]
29+
#![no_std]
2930

3031
//! `ksq` is an implementation of a K2 tree (k²-tree), which, when storing
3132
//! sparse bits, is a very space-effective matrix. This library implements
@@ -36,6 +37,14 @@
3637
//! means that the tree will grow by `N<<4` each layer -- and each cell can
3738
//! represent a maximum of 16 other cells, not 8.
3839
40+
pub(crate) mod std {
41+
extern crate alloc;
42+
extern crate core;
43+
44+
pub use alloc::*;
45+
pub use core::*;
46+
}
47+
3948
mod cell;
4049
mod layer;
4150
mod matrix;

src/matrix.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ impl Matrix {
102102
#[cfg(test)]
103103
mod tests {
104104
use super::*;
105+
use crate::std::{vec, vec::Vec};
105106

106107
#[test]
107108
fn matrix_dimensions() {

src/tree.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1919
// THE SOFTWARE. }}}
2020

21-
use super::{Cell, CellRepr, CountOnes, Layer};
21+
use super::{
22+
Cell, CellRepr, CountOnes, Layer,
23+
std::{vec, vec::Vec},
24+
};
2225

2326
/// A `tree` is the user-facing 1-dimensional bit vector. The `tree` can store
2427
/// a fixed number of bits, which can be accessed using [Tree::get],

src/tree_iterator.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1919
// THE SOFTWARE. }}}
2020

21-
use super::{Cell, Tree};
22-
use std::ops::Range;
21+
use super::{
22+
Cell, Tree,
23+
std::{ops::Range, vec::Vec},
24+
};
2325

2426
impl Tree {
2527
/// Iterate over all the bits in the tree. Once called, this will take
@@ -233,6 +235,7 @@ where
233235
#[cfg(test)]
234236
mod tests {
235237
use super::*;
238+
use crate::std::vec;
236239

237240
#[test]
238241
fn tree_iter() {

0 commit comments

Comments
 (0)