Skip to content

Commit 67fed94

Browse files
Refactor for #![no_std] usage (#2)
* Allow #![no_std] use Can’t use this crate in a low-level project like an OS kernel without this change. * Import Vec from alloc crate instead of std * Use the structures provided by the alloc crate in the macros
1 parent c08786e commit 67fed94

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use std::mem;
1+
extern crate alloc;
2+
3+
use core::mem;
4+
use alloc::vec::Vec;
25

36
const fn pos<K>(l: &usize, _: &K, _: &Vec<K>) -> usize {
47
*l

src/macros.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
use crate::Vectorable;
2+
use alloc::vec::Vec;
3+
use alloc::string::String;
24

35
#[doc(hidden)]
46
#[macro_export]

0 commit comments

Comments
 (0)