[−][src]Struct memflow::mem::cache::cached_memory_access::CachedMemoryAccess
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]
T: Clone,
Q: CacheValidator + Clone,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, T: PhysicalMemory, Q: CacheValidator> PhysicalMemory for CachedMemoryAccess<'a, T, Q>
[src]
fn phys_read_raw_list(
&mut self,
data: &mut [PhysicalReadData<'_>]
) -> Result<()>
[src]
&mut self,
data: &mut [PhysicalReadData<'_>]
) -> Result<()>
fn phys_write_raw_list(&mut self, data: &[PhysicalWriteData<'_>]) -> Result<()>
[src]
fn metadata(&self) -> PhysicalMemoryMetadata
[src]
fn phys_read_raw_into(
&mut self,
addr: PhysicalAddress,
out: &mut [u8]
) -> Result<()>
[src]
&mut self,
addr: PhysicalAddress,
out: &mut [u8]
) -> Result<()>
fn phys_read_into<T: Pod + ?Sized>(
&mut self,
addr: PhysicalAddress,
out: &mut T
) -> Result<()> where
Self: Sized,
[src]
&mut self,
addr: PhysicalAddress,
out: &mut T
) -> Result<()> where
Self: Sized,
fn phys_read_raw(
&mut self,
addr: PhysicalAddress,
len: usize
) -> Result<Vec<u8>>
[src]
&mut self,
addr: PhysicalAddress,
len: usize
) -> Result<Vec<u8>>
fn phys_read<T: Pod + Sized>(&mut self, addr: PhysicalAddress) -> Result<T> where
Self: Sized,
[src]
Self: Sized,
fn phys_write_raw(&mut self, addr: PhysicalAddress, data: &[u8]) -> Result<()>
[src]
fn phys_write<T: Pod + ?Sized>(
&mut self,
addr: PhysicalAddress,
data: &T
) -> Result<()> where
Self: Sized,
[src]
&mut self,
addr: PhysicalAddress,
data: &T
) -> Result<()> where
Self: Sized,
fn phys_batcher(&mut self) -> PhysicalMemoryBatcher<'_, Self> where
Self: Sized,
[src]
Self: Sized,
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,
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,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CloneablePhysicalMemory for T where
T: PhysicalMemory + Clone + 'static,
[src]
T: PhysicalMemory + Clone + 'static,
fn clone_box(&Self) -> Box<dyn CloneablePhysicalMemory + 'static>
[src]
fn downcast(&mut Self) -> &mut dyn PhysicalMemory
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, P> PhysicalMemory for P where
P: Send + DerefMut<Target = T>,
T: PhysicalMemory + ?Sized,
[src]
P: Send + DerefMut<Target = T>,
T: PhysicalMemory + ?Sized,
fn phys_read_raw_list(
&mut Self,
&mut [PhysicalReadData<'_>]
) -> Result<(), Error>
[src]
&mut Self,
&mut [PhysicalReadData<'_>]
) -> Result<(), Error>
fn phys_write_raw_list(&mut Self, &[PhysicalWriteData<'_>]) -> Result<(), Error>
[src]
fn metadata(&Self) -> PhysicalMemoryMetadata
[src]
fn phys_read_raw_into(
&mut self,
addr: PhysicalAddress,
out: &mut [u8]
) -> Result<()>
[src]
&mut self,
addr: PhysicalAddress,
out: &mut [u8]
) -> Result<()>
fn phys_read_into<T: Pod + ?Sized>(
&mut self,
addr: PhysicalAddress,
out: &mut T
) -> Result<()> where
Self: Sized,
[src]
&mut self,
addr: PhysicalAddress,
out: &mut T
) -> Result<()> where
Self: Sized,
fn phys_read_raw(
&mut self,
addr: PhysicalAddress,
len: usize
) -> Result<Vec<u8>>
[src]
&mut self,
addr: PhysicalAddress,
len: usize
) -> Result<Vec<u8>>
fn phys_read<T: Pod + Sized>(&mut self, addr: PhysicalAddress) -> Result<T> where
Self: Sized,
[src]
Self: Sized,
fn phys_write_raw(&mut self, addr: PhysicalAddress, data: &[u8]) -> Result<()>
[src]
fn phys_write<T: Pod + ?Sized>(
&mut self,
addr: PhysicalAddress,
data: &T
) -> Result<()> where
Self: Sized,
[src]
&mut self,
addr: PhysicalAddress,
data: &T
) -> Result<()> where
Self: Sized,
fn phys_batcher(&mut self) -> PhysicalMemoryBatcher<'_, Self> where
Self: Sized,
[src]
Self: Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,