pub struct RcDevice<Bus> { /* private fields */ }Available on crate features
std or alloc only.Expand description
Rc<RefCell<T>>-based shared bus I2c implementation.
This is the reference-counting equivalent of RefCellDevice.
Sharing is implemented with a RefCell and ownership is managed by Rc.
Like RefCellDevice, RcDevice instances are not Send,
so they can only be shared within a single thread (interrupt priority level).
When this RcDevice is dropped, the reference count of the I2C bus will be decremented.
Once that reference count hits zero, it will be cleaned up.
Implementations§
Trait Implementations§
Source§impl<Bus> ErrorType for RcDevice<Bus>where
Bus: ErrorType,
Available on crate feature alloc only.
impl<Bus> ErrorType for RcDevice<Bus>where
Bus: ErrorType,
Available on crate feature
alloc only.Source§impl<Bus> I2c for RcDevice<Bus>where
Bus: I2c,
Available on crate feature alloc only.
impl<Bus> I2c for RcDevice<Bus>where
Bus: I2c,
Available on crate feature
alloc only.Source§fn write(&mut self, address: u8, write: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, address: u8, write: &[u8]) -> Result<(), Self::Error>
Writes bytes to slave with address
address. Read moreAuto Trait Implementations§
impl<Bus> Freeze for RcDevice<Bus>
impl<Bus> !RefUnwindSafe for RcDevice<Bus>
impl<Bus> !Send for RcDevice<Bus>
impl<Bus> !Sync for RcDevice<Bus>
impl<Bus> Unpin for RcDevice<Bus>
impl<Bus> !UnwindSafe for RcDevice<Bus>
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
Mutably borrows from an owned value. Read more