Struct rsim::processor::isa_mods::csrs::ZicsrConn[][src]

pub struct ZicsrConn<'a, T> where
    T: From<u8>, 
{ pub sreg: &'a mut dyn RegisterFile<T>, pub csr_providers: Vec<&'a mut dyn CSRProvider<T>>, }

References to all CSR providers

Fields

sreg: &'a mut dyn RegisterFile<T>csr_providers: Vec<&'a mut dyn CSRProvider<T>>

Implementations

impl<'a, T> ZicsrConn<'a, T> where
    T: From<u8>, 
[src]

fn provider_of_csr(
    &mut self,
    csr: u32
) -> Option<&mut &'a mut dyn CSRProvider<T>>
[src]

Explanation of return type: OK, so this is really annoying. We want to return a reference to one of the mutrefs inside csr_providers. However, we can’t just copy the mutref out, because that would mean two copies exist - one in csr_providers, and one in our return value. => we have to return a reference to the mutref - &(&'a mut dyn CSRProvider). Because we want to modify the thing at the end of the mutref, Rust complains and wants the outer reference to be mutable as well. => & mut (&'a mut dyn CSRProvider) And, because we may not find anything, wrap the whole thing in an Option => Option<& mut &'a mut dyn CSRProvider>

Trait Implementations

impl<T> IsaMod<ZicsrConn<'_, T>> for Zicsr<T> where
    T: From<u8>, 
[src]

type Pc = T

Auto Trait Implementations

impl<'a, T> !RefUnwindSafe for ZicsrConn<'a, T>

impl<'a, T> !Send for ZicsrConn<'a, T>

impl<'a, T> !Sync for ZicsrConn<'a, T>

impl<'a, T> Unpin for ZicsrConn<'a, T>

impl<'a, T> !UnwindSafe for ZicsrConn<'a, T>

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> From<T> for T[src]

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

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.