cfg_select! {
target_arch = "wasm32" => {
mod wasm;
pub use wasm::DefaultMemoryImpl;
}
_ => {
pub type DefaultMemoryImpl = VectorMemory;
}
}
pub use crate::substrate::{Memory, VectorMemory};
use std::{rc::Rc, sync::Arc};
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct BackingIdentity(usize);
impl BackingIdentity {
#[must_use]
pub fn of_rc<T: ?Sized>(backing: &Rc<T>) -> Self {
Self(Rc::as_ptr(backing).cast::<()>() as usize)
}
#[must_use]
pub fn of_arc<T: ?Sized>(backing: &Arc<T>) -> Self {
Self(Arc::as_ptr(backing).cast::<()>() as usize)
}
}