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

Cargo Feature Matrix

The crate should compile in small configurations. Optional features must isolate dependencies that are not needed by core users.

Intended Features

FeaturePurposeExpected modules
stdStandard library supportall default builds
tlTL types and helperssrc/tl
tvmTVM primitivessrc/tvm, src/tlb
adnlADNL crypto and base typessrc/adnl without TCP runtime if split further
adnl-tcpasync TCP ADNLADNL peer, codec, handshake over Tokio
liteclientLiteAPI clientsrc/liteclient
network-configTON global config parsingsrc/network_config
clicommand line appsrc/cli, src/main.rs

Default target:

default = ["std", "adnl-tcp", "liteclient"]

Dependency Policy

Always acceptable when needed:

  • pure Rust crypto crates,
  • pure Rust async crates,
  • serialization crates,
  • testing and fixture crates as dev-dependencies.

Avoid:

  • native runtime libraries,
  • third-party Rust TON SDK crates,
  • mandatory HTTP clients in library default features,
  • mandatory logging implementations.

Verification Matrix

Required local commands:

cargo check --no-default-features
cargo check
cargo check --all-features
cargo test
cargo test --all-features

CI should also run:

cargo fmt --check

Feature Design Rules

  • A module behind a feature should not leak types into always-compiled public APIs.
  • Optional dependencies should be marked with dep:name in feature definitions.
  • Dev-dependencies are allowed for tests even if the corresponding runtime dependency is optional.
  • Examples and binaries should use required-features.

Known Gaps

  • tl currently has response conversion helpers that mention LiteError.
  • adnl and adnl-tcp need a cleaner split if UDP support is added.
  • network-config parsing and HTTP downloading should remain separate.