Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Feature Flags

ferogram

FeatureDefaultDescription
sqlite-sessionSQLite-backed session storage via rusqlite
libsql-sessionlibsql / Turso session storage: local or remote (Added in v0.4.7)
htmlBuilt-in hand-rolled HTML parser (parse_html, generate_html)
html5everSpec-compliant html5ever tokenizer: overrides the built-in html parser
serdeserde::Serialize / Deserialize on Config and public structs

The following are always available without any feature flag:

  • InlineKeyboard, ReplyKeyboard, Button: keyboard builders
  • InputReactions: reaction builder
  • TypingGuard: RAII typing indicator
  • SearchBuilder, GlobalSearchBuilder: fluent search
  • PeerRef: flexible peer argument
  • User, Group, Channel, Chat: typed wrappers
  • Socks5Config: SOCKS5 proxy config
  • BannedRightsBuilder, AdminRightsBuilder, ParticipantPermissions
  • StringSessionBackend, InMemoryBackend, BinaryFileBackend
  • ClientBuilder: fluent connection builder
# SQLite session only
ferogram = { version = "0.1.1", features = ["sqlite-session"] }

# LibSQL / Turso session (new in 0.1.1)
ferogram = { version = "0.1.1", features = ["libsql-session"] }

# HTML parsing (minimal, no extra deps)
ferogram = { version = "0.1.1", features = ["html"] }

# HTML parsing (spec-compliant, adds html5ever dep)
ferogram = { version = "0.1.1", features = ["html5ever"] }

# Multiple features at once
ferogram = { version = "0.1.1", features = ["sqlite-session", "html"] }

ferogram-tl-types

FeatureDefaultDescription
tl-apiTelegram API schema (constructors, functions, enums)
tl-mtprotoLow-level MTProto transport types
impl-debug#[derive(Debug)] on all generated types
impl-from-typeFrom<types::T> for enums::E conversions
impl-from-enumTryFrom<enums::E> for types::T conversions
deserializable-functionsDeserializable for function types (server-side use)
name-for-idname_for_id(id: u32) -> Option<&'static str>
impl-serdeserde::Serialize + serde::Deserialize on all types

Example: enable serde

ferogram-tl-types = { version = "0.1.1", features = ["tl-api", "impl-serde"] }
#![allow(unused)]
fn main() {
let json = serde_json::to_string(&some_tl_type)?;
}

Example: name_for_id (debugging)

ferogram-tl-types = { version = "0.1.1", features = ["tl-api", "name-for-id"] }
#![allow(unused)]
fn main() {
use ferogram_tl_types::name_for_id;

if let Some(name) = name_for_id(0x74ae4240) {
    println!("Constructor: {name}"); // → "updates"
}
}

Example: minimal (no Debug, no conversions)

ferogram-tl-types = { version = "0.1.1", default-features = false, features = ["tl-api"] }

Reduces compile time when you don’t need convenience traits.


String session: no feature flag needed

StringSessionBackend and export_session_string() are available in the default build: no feature flag required:

ferogram = "0.1.1"   # already includes StringSessionBackend
#![allow(unused)]
fn main() {
let s = client.export_session_string().await?;
let (client, _) = Client::with_string_session(&s, api_id, api_hash).await?;
}

docs.rs build matrix

When building docs on docs.rs, all feature flags are enabled:

[package.metadata.docs.rs]
features = ["sqlite-session", "libsql-session", "html", "html5ever"]
rustdoc-args = ["--cfg", "docsrs"]