pub trait MemorySlice: Send + Debug + PartialEq + Eq + Clone + Hash {
    type Edge: Edge;
    type EdgeIterator: Iterator<Item = Self::Edge>;

    // Required methods
    fn iter_edges(&self) -> Self::EdgeIterator;
    fn object(&self) -> Option<ObjectReference>;
    fn start(&self) -> Address;
    fn bytes(&self) -> usize;
    fn copy(src: &Self, tgt: &Self);
Expand description

A abstract memory slice represents a piece of heap memory.

Required Associated Types§


type Edge: Edge

The associate type to define how to access edges from a memory slice.


type EdgeIterator: Iterator<Item = Self::Edge>

The associate type to define how to iterate edges in a memory slice.

Required Methods§


fn iter_edges(&self) -> Self::EdgeIterator

Iterate object edges within the slice. If there are non-reference values in the slice, the iterator should skip them.


fn object(&self) -> Option<ObjectReference>

The object which this slice belongs to. If we know the object for the slice, we will check the object state (e.g. mature or not), rather than the slice address. Normally checking the object and checking the slice does not make a difference, as the slice is part of the object (in terms of memory range). However, if a slice is in a different location from the object, the object state and the slice can be hugely different, and providing a proper implementation of this method for the owner object is important.


fn start(&self) -> Address

Start address of the memory slice


fn bytes(&self) -> usize

Size of the memory slice


fn copy(src: &Self, tgt: &Self)

Memory copy support

Implementations on Foreign Types§


impl MemorySlice for Range<Address>