1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2020 - developers of the `grammers` project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! This library is an implementation of the [Mobile Transport Protocol].
//!
//! It is capable of efficiently packing enqueued requests into message
//! containers to later be encrypted and transmitted, and processing the
//! server responses to maintain a correct state.
//!
//! [Mobile Transport Protocol]: https://core.telegram.org/mtproto
pub mod authentication;
pub mod errors;
mod manual_tl;
mod mtp;
mod plain_mtp;
pub mod transports;
mod utils;

pub use mtp::Mtp;
pub use plain_mtp::PlainMtp;

/// The default compression threshold to be used.
pub const DEFAULT_COMPRESSION_THRESHOLD: Option<usize> = Some(512);

/// A Message Identifier.
///
/// When requests are enqueued, a new associated message identifier is
/// returned. As server responses get processed, some of them will be a
/// response to a previous request. You can now  `pop_response` to get
/// all the server responses, and if one matches your original identifier,
/// you will know the response corresponds to it.
#[derive(Copy, Clone, Debug, Hash, PartialEq, PartialOrd, Eq, Ord)]
pub struct MsgId(i64);