pub fn read_object<T: ByteCode>(&self, addr: GuestAddress) -> Result<T> {
        let mut obj = T::default();
        self.read(
            &mut obj.as_mut_bytes(),
            addr,
            std::mem::size_of::<T>() as u64,
        )
        .chain_err(|| "Failed to read object")?;
        Ok(obj)
    }
/// Read some data from memory to form an object.
///
/// # Arguments
///
/// * `addr` - The start guest address where the data will be read from.
///
/// # Note
/// To use this method, it is necessary to implement `ByteCode` trait for your object.
Read some data from memory to form an object.
Read some data from memory to form an object .
pub fn read_object<T: ByteCode>(&self, addr: GuestAddress) -> Result<T> {
        let mut obj = T::default();
        self.read(
            &mut obj.as_mut_bytes(),
            addr,
            std::mem::size_of::<T>() as u64,
        )
        .chain_err(|| "Failed to read object")?;
        Ok(obj)
    }
pub fn read_object < T : ByteCode > ( & self , addr : GuestAddress ) -> Result < T > { let mut obj = T :: default ( ) ; self . read ( & mut obj . as_mut_bytes ( ) , addr , std :: mem :: size_of :: < T > ( ) as u64 , ) . chain_err ( | | " " ) ? ; Ok ( obj ) }
Read some data from memory to form an object.
Read some data from memory to form an object .
&self
addr
GuestAddress
&self
addr
GuestAddress
note
To use this method, it is necessary to implement `ByteCode` trait for your object.
To use this method it is necessary to implement ` ByteCode ` trait for your object .