Skip to main content

NestableSerializer

Trait NestableSerializer 

Source
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§

Source

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.

Source

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.

Implementors§