use std::sync::Arc;
pub use crate::handle::{BaseHandle, Handle, RefHandle, TryFromHandle};
pub mod buffer;
pub mod handle;
pub mod slice;
pub type ArcHandle<B, T> = BaseHandle<Arc<B>, T>;
impl<B: AsRef<[u8]>> ArcHandle<B, ()> {
pub fn new_arc(inner: B) -> Self {
Self::new(Arc::new(inner))
}
}
impl<B: AsRef<[u8]>, T: Copy> ArcHandle<B, T> {
pub fn as_bytes_handle(&self) -> Handle<T> {
BaseHandle {
mem: self.mem.as_ref().as_ref(),
raw: self.raw,
}
}
}
pub type SliceHandle<'a, T> = RefHandle<'a, [T]>;
pub type SliceIterHandle<'a, T> = Handle<'a, std::slice::Iter<'a, T>>;