pub struct UartResponse {
pub address: u8,
pub request_creation_time: Instant,
/* private fields */
}
Expand description
Структура отдельного ответа при коммуникации по шине SPI
Fields§
§address: u8
Адрес подчиненного устройства
request_creation_time: Instant
Время создания запроса.
Можно контролировать время выполнения запросов
Implementations§
Source§impl UartResponse
impl UartResponse
Sourcepub fn get_payload<T>(&mut self) -> Result<T, Error>where
T: DeserializeOwned,
pub fn get_payload<T>(&mut self) -> Result<T, Error>where
T: DeserializeOwned,
Десериализация ответа
Sourcepub fn set_request_creation_time(&mut self, request_creation_time: Instant)
pub fn set_request_creation_time(&mut self, request_creation_time: Instant)
Установить время создания запроса
Время не передается по сети, поэтому необходимо устанавливать вручную
Sourcepub fn from_read_buffer(read_buf: &mut [u8]) -> Result<Self, Error>
pub fn from_read_buffer(read_buf: &mut [u8]) -> Result<Self, Error>
Восстановить ответ из буфера передачи по сети
Trait Implementations§
Source§impl Clone for UartResponse
impl Clone for UartResponse
Source§fn clone(&self) -> UartResponse
fn clone(&self) -> UartResponse
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for UartResponse
impl RefUnwindSafe for UartResponse
impl Send for UartResponse
impl Sync for UartResponse
impl Unpin for UartResponse
impl UnwindSafe for UartResponse
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