Skip to main content

EditRegister

Trait EditRegister 

Source
pub trait EditRegister<R, A>
where R: EditableRegister<Address = A>,
{ type Error; // Required method fn edit<F>(&mut self, f: F) -> Result<(), Self::Error> where for<'w> F: FnOnce(&'w mut R); }
Expand description

Trait to safely read-edit-write a register. Usefull when a register has reserved values for internal uses. Avoids writing garbage to the reserved bits.

Required Associated Types§

Source

type Error

Error type returned by editing the register

Required Methods§

Source

fn edit<F>(&mut self, f: F) -> Result<(), Self::Error>
where for<'w> F: FnOnce(&'w mut R),

Edit a register. The closure takes a reference to the register, the same register must be edited, then returned.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<I, R, A> EditRegister<R, A> for I
where R: EditableRegister<Address = A>, I: RegisterInterface<R, A>,