pub struct TpBufConfig {
pub tp_buffer_start_payload_alloc_len: usize,
/* private fields */
}Expand description
Configuration of a TP buffers maximum allowed size and initial allocated buffer size.
Fields§
§tp_buffer_start_payload_alloc_len: usizeNumber of bytes that should be allocated to store payload
when a new TpBuf gets created.
Implementations§
Source§impl TpBufConfig
impl TpBufConfig
Sourcepub const MAX_TP_PAYLOAD_LEN: u32 = 4_294_967_279u32
pub const MAX_TP_PAYLOAD_LEN: u32 = 4_294_967_279u32
Maximum representable payload len in a TP packet.
This is determined by the maximum value the length field in the SOMEIP header can take - 8 bytes
Sourcepub fn tp_max_payload_len(&self) -> u32
pub fn tp_max_payload_len(&self) -> u32
Maximum allowed payload length (in bytes) of the final reconstructed packet.
Sourcepub fn new(
tp_buffer_start_payload_alloc_len: usize,
tp_max_payload_len: u32,
) -> Result<TpBufConfig, TpBufConfigError>
pub fn new( tp_buffer_start_payload_alloc_len: usize, tp_max_payload_len: u32, ) -> Result<TpBufConfig, TpBufConfigError>
Creates a new config with the given initial allocated and maximum allowed payload size.
§Example
As long as you don’t set the max_payload_len to more then
TpBufConfig::MAX_TP_PAYLOAD_LEN (0xFFFFFFFF - 16):
use someip_parse::TpBufConfig;
let config = TpBufConfig::new(
// start alloc size
1024,
// maximum allowed size
// (if you have knowledge about the maximum message size,
// insert that here and above)
TpBufConfig::MAX_TP_PAYLOAD_LEN
).unwrap();construction will only fail if you set an upper lenght greater
then TpBufConfig::MAX_TP_PAYLOAD_LEN:
use someip_parse::{TpBufConfig, err::TpBufConfigError::*};
assert_eq!(
TpBufConfig::new(1024, TpBufConfig::MAX_TP_PAYLOAD_LEN + 1),
Err(MaxPayloadLenTooBig{
allowed_max: TpBufConfig::MAX_TP_PAYLOAD_LEN,
actual: TpBufConfig::MAX_TP_PAYLOAD_LEN + 1,
})
);Trait Implementations§
Source§impl Clone for TpBufConfig
impl Clone for TpBufConfig
Source§fn clone(&self) -> TpBufConfig
fn clone(&self) -> TpBufConfig
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TpBufConfig
impl Debug for TpBufConfig
Source§impl Default for TpBufConfig
impl Default for TpBufConfig
Source§impl Hash for TpBufConfig
impl Hash for TpBufConfig
Source§impl Ord for TpBufConfig
impl Ord for TpBufConfig
Source§impl PartialEq for TpBufConfig
impl PartialEq for TpBufConfig
Source§impl PartialOrd for TpBufConfig
impl PartialOrd for TpBufConfig
impl Eq for TpBufConfig
impl StructuralPartialEq for TpBufConfig
Auto Trait Implementations§
impl Freeze for TpBufConfig
impl RefUnwindSafe for TpBufConfig
impl Send for TpBufConfig
impl Sync for TpBufConfig
impl Unpin for TpBufConfig
impl UnwindSafe for TpBufConfig
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)