pub struct RegisterAccess {
pub ty: Option<RegisterAccessType>,
pub addr: Option<usize>,
pub len: Option<usize>,
pub before: Option<u64>,
pub after: Option<u64>,
}Expand description
Stores information of a specific registers access.
Members are all optional to allow for easy partial comparison. See the
PartialEq
implementation for more details and specific examples.
See the convenience functions access_gen::read, access_gen::read_value,
access_gen::write and access_gen::write_value for a shorthand ways to
construct RegisterAccess structs.
Fields§
§ty: Option<RegisterAccessType>Type of the register access.
addr: Option<usize>Address of accessed register.
len: Option<usize>Length of the access mask in bytes.
before: Option<u64>Value of the register before the access.
after: Option<u64>Value of the register after the access.
Implementations§
Source§impl RegisterAccess
impl RegisterAccess
Sourcepub fn new(
ty: RegisterAccessType,
addr: usize,
len: usize,
before: u64,
after: u64,
) -> Self
pub fn new( ty: RegisterAccessType, addr: usize, len: usize, before: u64, after: u64, ) -> Self
Constructor for RegisterAccess that takes all its members as arguments.
See also the shorthand constructors access_gen::read, access_gen::read_value,
access_gen::write and access_gen::write_value for constructing partial
RegisterAccess structs.
Sourcepub fn seq_from_json(data: &str) -> Vec<RegisterAccess>
pub fn seq_from_json(data: &str) -> Vec<RegisterAccess>
Deserialize a sequence of register accesses from a JSON array.
Trait Implementations§
Source§impl Clone for RegisterAccess
impl Clone for RegisterAccess
Source§fn clone(&self) -> RegisterAccess
fn clone(&self) -> RegisterAccess
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RegisterAccess
impl Debug for RegisterAccess
Source§impl Default for RegisterAccess
impl Default for RegisterAccess
Source§fn default() -> RegisterAccess
fn default() -> RegisterAccess
Source§impl<'de> Deserialize<'de> for RegisterAccesswhere
RegisterAccess: Default,
impl<'de> Deserialize<'de> for RegisterAccesswhere
RegisterAccess: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for RegisterAccess
Compares only part of the struct that are Some() on &self. As this struct
should only be used for writing unit tests, it is useful to provide
an implementation of PartialEq that checks values that are there.
Consequent this means that a RegisterAccess struct with all members
None is equal to every RegisterAccess struct.
impl PartialEq for RegisterAccess
Compares only part of the struct that are Some() on &self. As this struct
should only be used for writing unit tests, it is useful to provide
an implementation of PartialEq that checks values that are there.
Consequent this means that a RegisterAccess struct with all members
None is equal to every RegisterAccess struct.
§Examples
use regmock_rs::utils::*;
let full = RegisterAccess::new(RegisterAccessType::READ,
0xDEADC0DE,
8,
0x0,
0xC0FFEE,
);
let mut partial = RegisterAccess::default();
partial.ty = Some(RegisterAccessType::READ);
assert_eq!(partial, full);impl Eq for RegisterAccess
Auto Trait Implementations§
impl Freeze for RegisterAccess
impl RefUnwindSafe for RegisterAccess
impl Send for RegisterAccess
impl Sync for RegisterAccess
impl Unpin for RegisterAccess
impl UnwindSafe for RegisterAccess
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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