ptr::NonNull,
};
-use crate::bindings;
+use crate::{bindings, impl_vmstate_transparent};
/// An internal function that is used by doctests.
pub fn bql_start_test() {
}
}
+impl_vmstate_transparent!(crate::cell::BqlCell<T> where T: VMState);
+
/// A mutable memory location with dynamically checked borrow rules,
/// protected by the Big QEMU Lock.
///
}
}
+impl_vmstate_transparent!(crate::cell::BqlRefCell<T> where T: VMState);
+
struct BorrowRef<'b> {
borrow: &'b Cell<BorrowFlag>,
}
/// * scalar types (integer and `bool`)
/// * the C struct `QEMUTimer`
/// * a transparent wrapper for any of the above (`Cell`, `UnsafeCell`,
-/// [`BqlCell`], [`BqlRefCell`]
+/// [`BqlCell`](crate::cell::BqlCell),
+/// [`BqlRefCell`](crate::cell::BqlRefCell)),
/// * a raw pointer to any of the above
/// * a `NonNull` pointer, a `Box` or an [`Owned`](crate::qom::Owned) for any of
/// the above
// Transparent wrappers: just use the internal type
+#[macro_export]
macro_rules! impl_vmstate_transparent {
($type:ty where $base:tt: VMState $($where:tt)*) => {
- unsafe impl<$base> VMState for $type where $base: VMState $($where)* {
- const BASE: VMStateField = VMStateField {
+ unsafe impl<$base> $crate::vmstate::VMState for $type where $base: $crate::vmstate::VMState $($where)* {
+ const BASE: $crate::vmstate::VMStateField = $crate::vmstate::VMStateField {
size: mem::size_of::<$type>(),
- ..<$base as VMState>::BASE
+ ..<$base as $crate::vmstate::VMState>::BASE
};
- const VARRAY_FLAG: VMStateFlags = <$base as VMState>::VARRAY_FLAG;
+ const VARRAY_FLAG: $crate::bindings::VMStateFlags = <$base as $crate::vmstate::VMState>::VARRAY_FLAG;
}
};
}
impl_vmstate_transparent!(std::cell::Cell<T> where T: VMState);
impl_vmstate_transparent!(std::cell::UnsafeCell<T> where T: VMState);
impl_vmstate_transparent!(std::pin::Pin<T> where T: VMState);
-impl_vmstate_transparent!(crate::cell::BqlCell<T> where T: VMState);
-impl_vmstate_transparent!(crate::cell::BqlRefCell<T> where T: VMState);
impl_vmstate_transparent!(crate::cell::Opaque<T> where T: VMState);
#[macro_export]