Skip to content

Commit 576a7c0

Browse files
authored
Merge pull request #279 from kirk-baird/no-std-fix
Resolve issues with no std
2 parents 3fa2e73 + 598a5ba commit 576a7c0

File tree

17 files changed

+61
-0
lines changed

17 files changed

+61
-0
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ jobs:
9494
command: test
9595
args: --features serde
9696

97+
- name: Test no default features
98+
uses: actions-rs/cargo@v1
99+
with:
100+
command: test
101+
args: --no-default-features
102+
97103
- name: Test benchmarks
98104
uses: actions-rs/cargo@v1
99105
with:

src/bitmap/arbitrary.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ mod test {
88
use proptest::collection::{vec, SizeRange};
99
use proptest::prelude::*;
1010

11+
#[cfg(not(feature = "std"))]
12+
use alloc::boxed::Box;
13+
#[cfg(not(feature = "std"))]
14+
use alloc::vec::Vec;
15+
1116
impl Debug for BitmapStore {
1217
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
1318
if self.len() < 16 {

src/bitmap/container.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ use super::util;
88

99
pub const ARRAY_LIMIT: u64 = 4096;
1010

11+
#[cfg(not(feature = "std"))]
12+
use alloc::vec::Vec;
13+
1114
#[derive(PartialEq, Clone)]
1215
pub struct Container {
1316
pub key: u16,

src/bitmap/fmt.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ use core::fmt;
22

33
use crate::RoaringBitmap;
44

5+
#[cfg(not(feature = "std"))]
6+
use alloc::vec::Vec;
7+
58
impl fmt::Debug for RoaringBitmap {
69
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
710
if self.len() < 16 {

src/bitmap/inherent.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ use crate::RoaringBitmap;
66
use super::container::Container;
77
use super::util;
88

9+
#[cfg(not(feature = "std"))]
10+
use alloc::vec::Vec;
11+
912
impl RoaringBitmap {
1013
/// Creates an empty `RoaringBitmap`.
1114
///

src/bitmap/iter.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ use core::slice;
55
use super::container::Container;
66
use crate::{NonSortedIntegers, RoaringBitmap};
77

8+
#[cfg(not(feature = "std"))]
9+
use alloc::vec::Vec;
10+
811
/// An iterator for `RoaringBitmap`.
912
pub struct Iter<'a> {
1013
inner: iter::Flatten<slice::Iter<'a, Container>>,

src/bitmap/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ use self::cmp::Pairs;
2121
pub use self::iter::IntoIter;
2222
pub use self::iter::Iter;
2323

24+
#[cfg(not(feature = "std"))]
25+
use alloc::vec::Vec;
26+
2427
/// A compressed bitmap using the [Roaring bitmap compression scheme](https://roaringbitmap.org/).
2528
///
2629
/// # Examples

src/bitmap/multiops.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ use crate::{MultiOps, RoaringBitmap};
1111

1212
use super::{container::Container, store::Store};
1313

14+
#[cfg(not(feature = "std"))]
15+
use alloc::vec::Vec;
16+
1417
/// When collecting bitmaps for optimizing the computation. If we don't know how many
1518
// elements are in the iterator we collect 10 elements.
1619
const BASE_COLLECT: usize = 10;

src/bitmap/ops.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ use crate::bitmap::container::Container;
55
use crate::bitmap::Pairs;
66
use crate::RoaringBitmap;
77

8+
#[cfg(not(feature = "std"))]
9+
use alloc::vec::Vec;
10+
811
impl RoaringBitmap {
912
/// Computes the len of the intersection with the specified other bitmap without creating a
1013
/// new bitmap.

src/bitmap/store/array_store/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ use core::cmp::Ordering::*;
88
use core::fmt::{Display, Formatter};
99
use core::ops::{BitAnd, BitAndAssign, BitOr, BitXor, RangeInclusive, Sub, SubAssign};
1010

11+
#[cfg(not(feature = "std"))]
12+
use alloc::vec::Vec;
13+
14+
#[cfg(not(feature = "std"))]
15+
use alloc::boxed::Box;
16+
1117
use super::bitmap_store::{bit, key, BitmapStore, BITMAP_LENGTH};
1218

1319
#[derive(Clone, Eq, PartialEq)]

0 commit comments

Comments
 (0)