Initial commit
This commit is contained in:
30
src/application_data.rs
Normal file
30
src/application_data.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
use crate::buffer::CryptoBuffer;
|
||||
use crate::record::RecordHeader;
|
||||
use core::fmt::{Debug, Formatter};
|
||||
|
||||
pub struct ApplicationData<'a> {
|
||||
pub(crate) header: RecordHeader,
|
||||
pub(crate) data: CryptoBuffer<'a>,
|
||||
}
|
||||
|
||||
impl Debug for ApplicationData<'_> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
|
||||
write!(f, "ApplicationData {:x?}", self.data.len())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "defmt")]
|
||||
impl<'a> defmt::Format for ApplicationData<'a> {
|
||||
fn format(&self, f: defmt::Formatter<'_>) {
|
||||
defmt::write!(f, "ApplicationData {}", self.data.len());
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ApplicationData<'a> {
|
||||
pub fn new(rx_buf: CryptoBuffer<'a>, header: RecordHeader) -> ApplicationData<'a> {
|
||||
Self {
|
||||
header,
|
||||
data: rx_buf,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user