pub trait LimitedRecordsImplLayout {
type Error;
const EXACT_LIMIT_ERROR: Option<Self::Error> = None;
}
Expand description
Trait that provides implementations to limit the amount of records read from a buffer. Some protocols will have some sort of header preceding the records that will indicate the number of records to follow (e.g. IGMP), while others will have that information inline (e.g. IPv4 options).
If the implementer of this trait wishes to impose an Exact Limit constraint,
they should supply a value for EXACT_LIMIT_ERROR
.
Note that implementations of LimitedRecordsImpl
cannot be used in place of
implementations of RecordsImpl
directly as this does not implement
RecordsImpl
. Implementers will need to use the LimitedRecordsImplBridge
to create bindings to a RecordsImpl
. Alternatively, instead of using
Records<_, O>
where O
is a type that implements RecordsImpl
, implementers
can use LimitedRecords<_, P>
where P
is a type that implements
LimitedRecordsImpl
. See LimitedRecords
.
Provided Associated Constants§
Sourceconst EXACT_LIMIT_ERROR: Option<Self::Error> = None
const EXACT_LIMIT_ERROR: Option<Self::Error> = None
If Some(E)
, parse_with_context
of LimitedRecordsImplBridge
will emit the
provided constant as an error if the provided buffer is exhausted while context
is not 0, or if the context
reaches 0 but the provided buffer is not empty.
Required Associated Types§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.