[][src]Struct memflow::mem::cache::cached_memory_access::CachedMemoryAccess

pub struct CachedMemoryAccess<'a, T, Q> { /* fields omitted */ }

The cache object that can use as a drop-in replacement for any Connector.

Since this cache implements PhysicalMemory it can be used as a replacement in all structs and functions that require a PhysicalMemory object.

Implementations

impl<'a, T: PhysicalMemory, Q: CacheValidator> CachedMemoryAccess<'a, T, Q>[src]

pub fn new(mem: T, cache: PageCache<'a, Q>) -> Self[src]

Constructs a new cache based on the given PageCache.

This function is used when manually constructing a cache inside of the memflow crate itself.

For general usage it is advised to just use the builder to construct the cache.

pub fn destroy(self) -> T[src]

Consumes self and returns the containing memory object.

This function can be useful in case the ownership over the memory object has been given to the cache when it was being constructed. It will destroy the self and return back the ownership of the underlying memory object.

Examples

use memflow::architecture::x86::x64;
use memflow::mem::{PhysicalMemory, CachedMemoryAccess};

fn build<T: PhysicalMemory>(mem: T) -> T {
    let mut cache = CachedMemoryAccess::builder(mem)
        .arch(x64::ARCH)
        .build()
        .unwrap();

    // use the cache...
    let value: u64 = cache.phys_read(0.into()).unwrap();
    assert_eq!(value, MAGIC_VALUE);

    // retrieve ownership of mem and return it back
    cache.destroy()
}

impl<'a, T: PhysicalMemory> CachedMemoryAccess<'a, T, DefaultCacheValidator>[src]

pub fn builder(mem: T) -> CachedMemoryAccessBuilder<T, DefaultCacheValidator>[src]

Returns a new builder for this cache with default settings.

Trait Implementations

impl<'a, T, Q> Clone for CachedMemoryAccess<'a, T, Q> where
    T: Clone,
    Q: CacheValidator + Clone
[src]

impl<'a, T: PhysicalMemory, Q: CacheValidator> PhysicalMemory for CachedMemoryAccess<'a, T, Q>[src]

Auto Trait Implementations

impl<'a, T, Q> !RefUnwindSafe for CachedMemoryAccess<'a, T, Q>

impl<'a, T, Q> Send for CachedMemoryAccess<'a, T, Q> where
    T: Send

impl<'a, T, Q> !Sync for CachedMemoryAccess<'a, T, Q>

impl<'a, T, Q> Unpin for CachedMemoryAccess<'a, T, Q> where
    Q: Unpin,
    T: Unpin

impl<'a, T, Q> !UnwindSafe for CachedMemoryAccess<'a, T, Q>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CloneablePhysicalMemory for T where
    T: PhysicalMemory + Clone + 'static, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, P> PhysicalMemory for P where
    P: Send + DerefMut<Target = T>,
    T: PhysicalMemory + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.