limine_protocol_for_rust/
util.rs1pub struct PointerSlice<T: 'static> {
2 inner: &'static [*const T],
3}
4
5impl<T> From<&'static [*const T]> for PointerSlice<T> {
6 fn from(slice: &'static [*const T]) -> Self {
7 Self { inner: slice }
8 }
9}
10
11impl<T: 'static> PointerSlice<T> {
12 pub fn iter(&self) -> impl Iterator<Item = &T> {
13 self.inner.iter().map(|&ptr| unsafe { &*ptr })
14 }
15
16 pub fn get(&self, index: usize) -> Option<&T> {
17 self.inner.get(index).map(|&ptr| unsafe { &*ptr })
18 }
19}
20
21
22#[macro_export]
24macro_rules! group {
25 ($($tt:tt)*) => { $($tt)* }
26}