pub trait NestableSerializer: Sized {
// Provided methods
fn wrap_in<B: NestablePacketBuilder>(self, outer: B) -> Nested<Self, B> { ... }
fn with_size_limit(
self,
limit: usize,
) -> Nested<Self, LimitedSizePacketBuilder> { ... }
}Expand description
Extension trait for Serializer that allows for composition of serializers
without type hints by deferring the resolution of the concrete serialization
context type.
Provided Methods§
Sourcefn wrap_in<B: NestablePacketBuilder>(self, outer: B) -> Nested<Self, B>
fn wrap_in<B: NestablePacketBuilder>(self, outer: B) -> Nested<Self, B>
Encapsulates this Serializer in a packet, producing a new
Serializer.
wrap_in() consumes this Serializer and a PacketBuilder, and
produces a new Serializer which describes encapsulating this one in
the packet described by outer.
Sourcefn with_size_limit(self, limit: usize) -> Nested<Self, LimitedSizePacketBuilder>
fn with_size_limit(self, limit: usize) -> Nested<Self, LimitedSizePacketBuilder>
Creates a new Serializer which will enforce a size limit.
with_size_limit consumes this Serializer and limit, and produces a
new Serializer which will enforce the given limit on all serialization
requests. Note that the given limit will be enforced at this layer -
serialization requests will be rejected if the body produced by the
request at this layer would exceed the limit. It has no effect on
headers or footers added by encapsulating layers outside of this one.
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.