Skip to main content

BudgetedTransport

Struct BudgetedTransport 

Source
pub struct BudgetedTransport<T> { /* private fields */ }
Expand description

A blocking DLMS transport with a cumulative receive budget for each BlockingReader GET. Wrap the transport before calling [Client::connect].

Charge each received APDU, including its headers and block-transfer exchanges. Only APDUs within the budget reach the upstream client. The transport can read one further APDU into the driver’s frame buffer to determine its length. Association setup and ordinary release take place outside the GET budget. Configure deadlines and lower-layer framing limits on the underlying transport.

Implementations§

Source§

impl<T> BudgetedTransport<T>

Source

pub fn new(inner: T, max_response_bytes: NonZeroUsize) -> Self

Set the maximum number of incoming APDU bytes per attribute GET.

Source

pub fn into_inner(self) -> T

Recover the underlying transport, for example after a successful release.

Trait Implementations§

Source§

impl<T: Transport> Transport for BudgetedTransport<T>

Source§

fn send(&mut self, apdu: &[u8]) -> Result<()>

Send one APDU. Read more
Source§

fn recv(&mut self, buf: &mut [u8]) -> Result<usize>

Receive one APDU into buf, returning its length. Read more
Source§

fn close(&mut self) -> Result<()>

Close the link after the association is released. The default does nothing. Read more

Auto Trait Implementations§

§

impl<T> Freeze for BudgetedTransport<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for BudgetedTransport<T>
where T: RefUnwindSafe,

§

impl<T> Send for BudgetedTransport<T>
where T: Send,

§

impl<T> Sync for BudgetedTransport<T>
where T: Sync,

§

impl<T> Unpin for BudgetedTransport<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for BudgetedTransport<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for BudgetedTransport<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.