Struct mmtk::util::metadata::side_metadata::sanity::SideMetadataSanity
source · pub struct SideMetadataSanity {
specs_sanity_map: HashMap<&'static str, Vec<SideMetadataSpec>>,
}
Expand description
This struct includes a hashmap to store the metadata specs information for policy-specific and global metadata for each plan. It uses policy name (or GLOBAL_META_NAME for globals) as the key and keeps a vector of specs as the value. Each plan needs its exclusive instance of this struct to use side metadata specification and content sanity checker.
NOTE:
Content sanity check is expensive and is only activated with the extreme_assertions
feature.
FIXME: This struct should be pub(crate) visible, but changing its scope will need changing other scopes, such as the Space trait’s. For now, I will not do that.
Fields§
§specs_sanity_map: HashMap<&'static str, Vec<SideMetadataSpec>>
Implementations§
source§impl SideMetadataSanity
impl SideMetadataSanity
sourcepub fn new() -> SideMetadataSanity
pub fn new() -> SideMetadataSanity
Creates a new SideMetadataSanity instance.
sourcefn get_all_specs(&self, global: bool) -> Vec<SideMetadataSpec>
fn get_all_specs(&self, global: bool) -> Vec<SideMetadataSpec>
Returns all global or policy-specific specs based-on the input argument.
Returns a vector of globals if global
is true and a vector of locals otherwise.
Arguments:
global
: a boolean to show whether global (true
) or policy-specific (false
) specs are required.
sourcefn verify_local_specs(&self) -> Result<()>
fn verify_local_specs(&self) -> Result<()>
Verifies that all local side metadata specs: 1 - are not too big, 2 - do not overlap.
Returns Ok(())
if no issue is detected, or Err
otherwise.
sourcepub(crate) fn verify_metadata_context(
&mut self,
policy_name: &'static str,
metadata_context: &SideMetadataContext
)
pub(crate) fn verify_metadata_context( &mut self, policy_name: &'static str, metadata_context: &SideMetadataContext )
An internal method to ensure that a metadata context does not have any issues.
Arguments:
policy_name
: name of the policy of the calling spacemetadata_context
: the metadata context to examine
NOTE:
Any unit test using metadata directly or indirectly may need to make sure:
1 - it uses util::test_util::serial_test
to prevent metadata sanity conflicts,
2 - uses exclusive SideMetadata instances (v.s. static instances), and
3 - uses util::test_util::with_cleanup
to call sanity::reset
to cleanup the metadata sanity states to prevent future conflicts.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for SideMetadataSanity
impl Send for SideMetadataSanity
impl Sync for SideMetadataSanity
impl Unpin for SideMetadataSanity
impl UnwindSafe for SideMetadataSanity
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more