pub fn serialize_into<W, T: ?Sized, S, C>(writer: W, value: &T, size_limit: S) -> Result<()>
where
    W: Write,
    T: serde::ser::Serialize,
    S: SizeLimit,
    C: Encapsulation,
{
    if let Some(limit) = size_limit.limit() {
        calc_serialized_size_bounded(value, limit)?;
    }

    let mut serializer = Serializer::<_, C::E>::new(writer);

    serde::Serialize::serialize(&C::id(), &mut serializer)?;
    serde::Serialize::serialize(&C::option(), &mut serializer)?;
    serializer.reset_pos();
    serde::Serialize::serialize(value, &mut serializer)
}
/// Serializes an object directly into a `Write` with the encapsulation.
Serializes an object directly into a `Write` with the encapsulation.
Serializes an object directly into a ` Write ` with the encapsulation .
pub fn serialize_into<W, T: ?Sized, S, C>(writer: W, value: &T, size_limit: S) -> Result<()>
where
    W: Write,
    T: serde::ser::Serialize,
    S: SizeLimit,
    C: Encapsulation,
{
    if let Some(limit) = size_limit.limit() {
        calc_serialized_size_bounded(value, limit)?;
    }
    let mut serializer = Serializer::<_, C::E>::new(writer);
    serde::Serialize::serialize(&C::id(), &mut serializer)?;
    serde::Serialize::serialize(&C::option(), &mut serializer)?;
    serializer.reset_pos();
    serde::Serialize::serialize(value, &mut serializer)
}
pub fn serialize_into < W , T : ? Sized , S , C > ( writer : W , value : & T , size_limit : S ) -> Result < ( ) > where W : Write , T : serde :: ser :: Serialize , S : SizeLimit , C : Encapsulation , { if let Some ( limit ) = size_limit . limit ( ) { calc_serialized_size_bounded ( value , limit ) ? ; } let mut serializer = Serializer :: < _ , C :: E > :: new ( writer ) ; serde :: Serialize :: serialize ( & C :: id ( ) , & mut serializer ) ? ; serde :: Serialize :: serialize ( & C :: option ( ) , & mut serializer ) ? ; serializer . reset_pos ( ) ; serde :: Serialize :: serialize ( value , & mut serializer ) }
Serializes an object directly into a `Write` with the encapsulation.
Serializes an object directly into a ` Write ` with the encapsulation .
writer
W
value
&T
size_limit
S
writer
W
value
&T
size_limit
S