Struct httlib_protos::encoder::Encoder[][src]

pub struct Encoder;
Expand description

Provides the encoding engine for Protocol Buffers.

Implementations

A constant holding the minimum tag number of a field.

A constant holding the maximum tag number of a field.

Transforms a field into proto3 binary format and writes the result into dst.

By default, the encoder uses mostly “standard” variant formats for numbers. A developer can choose a specific format by passing the EncoderLit.

use httlib_protos::{Encoder, EncoderLit};
 
let encoder = Encoder::default();
 
let mut dst = Vec::new();
encoder.encode((1, &150i32), &mut dst).unwrap();
encoder.encode((2, EncoderLit::SInt32(&-150i32)), &mut dst).unwrap();

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided val into bool field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided vals into bool repeated field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided val into int32 field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided vals into int32 repeated field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided val into int64 field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided vals into int64 repeated field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided val into uint32 field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided vals into uint32 repeated field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided val into uint64 field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided vals into uint64 repeated field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided val into float field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided vals into float repeated field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided val into double field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided vals into double repeated field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided val into bytes field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided val into sint32 field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided vals into sin32 repeated field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided val into sint64 field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided vals into sin64 repeated field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided val into fixed32 field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided vals into fixed32 repeated field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided val into fixed64 field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided vals into fixed64 repeated field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided val into sfixed32 field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided vals into sfixed32 repeated field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided val into sfixed64 field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Encodes the provided vals into sfixed64 repeated field with a specific tag number and writes the resulting bytes into dst.

On success the number of written bytes is returned otherwise an error is thrown.

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.