[][src]Crate serde_mtproto

Serde MTProto

MTProto is a mobile-first protocol for access to a server API. This crate provides means to serialize Rust types to its binary representation and to deserialize from said representation.

Modules

de

Deserialize MTProto binary representation to a Rust data structure.

error

When serializing or deserializing MTProto goes wrong.

helpers

Helper types for assisting in some deserialization scenarios.

identifiable

Identifiable trait for any Rust data structure that can have an id.

ser

Serialize a Rust data structure into its MTProto binary representation.

sized

MtProtoSized trait for any Rust data structure a predictable size of its MTProto binary representation can be computed.

wrappers

Wrapper structs for attaching additional data to a type for deserialization purposes.

Structs

Boxed

A struct that wraps an Identifiable type value to serialize and deserialize as a boxed MTProto data type.

ByteBuf

Wrapper around Vec<u8> to serialize and deserialize efficiently.

Bytes

Wrapper around &[u8] to serialize and deserialize efficiently.

Deserializer

A structure that deserializes MTProto binary representation into Rust values.

Error

The Error type.

Serializer

A structure for serializing Rust values into MTProto binary representation.

UnsizedByteBuf

A byte buffer which doesn't write its length when serialized.

UnsizedByteBufSeed

An unsized byte buffer seed with the length of the byte sequence to be deserialized.

WithSize

A struct that wraps a MtProtoSized type value to serialize and deserialize as a MTProto data type with the size of its serialized value.

Enums

ErrorKind

The kind of an error.

Traits

Identifiable

A trait for a Rust data structure that can have an id.

MtProtoSized

A trait for a Rust data structure a predictable size of its MTProto binary representation can be computed.

ResultExt

Additional methods for Result, for easy interaction with this crate.

Functions

from_bytes

Deserialize an instance of type T from bytes of binary MTProto.

from_bytes_reuse

Deserialize an instance of type T from bytes of binary MTProto and return unused bytes.

from_bytes_seed

Deserialize an instance of type T from bytes of binary MTProto using a seed.

from_reader

Deserialize an instance of type T from an IO stream of binary MTProto.

from_reader_reuse

Deserialize an instance of type T from an IO stream of binary MTProto and return unused part of IO stream.

from_reader_seed

Deserialize an instance of type T from an IO stream of binary MTProto using a seed.

size_hint_from_byte_seq_len

Helper function for everything naturally representable as a byte sequence.

to_bytes

Serialize the given data structure as a byte vector of binary MTProto.

to_writer

Serialize the given data structure as binary MTProto into the IO stream.

unsized_bytes_pad_to_bytes

Serialize bytes with padding to 16 bytes as a byte vector of binary MTProto.

unsized_bytes_pad_to_writer

Serialize bytes with padding to 16 bytes into the IO stream.

Type Definitions

Result

Convenient wrapper around std::Result.

WithId

An alias for Boxed that is similar to WithSize.