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 features

Generated rustdoc: https://docs.rs/babar/latest/babar/index.html

See also: Book Chapter 12 — TLS & security and Chapter 10 — Custom codecs.

Every feature flag the babar crate (and its core crate babar-core) exposes. All features are off by default except the ones listed in default = [...].

TLS backends

FeatureWhat it enablesDefault?
rustlsThe pure-Rust TLS backend (TlsBackend::Rustls). Pulls in rustls, tokio-rustls, and rustls-native-certs.yes
native-tlsPlatform TLS via native-tls + tokio-native-tls (Schannel / Secure Transport / OpenSSL). Selectable via TlsBackend::NativeTls.no

Only one TLS backend is needed at runtime; you can enable both if you want to pick at runtime. Config::tls_mode(TlsMode::Disable) opts out of TLS entirely without touching features.

Codec features

Each row turns on a codec module under babar::codec. Disabling unused codec features is the most effective way to keep babar’s compile time and binary size small.

FeatureCodec moduleHeadline typesExtra deps
uuidbabar::codec::uuiduuid::Uuid ↔ Postgres uuiduuid
timebabar::codec::timetime::Date / Time / PrimitiveDateTime / OffsetDateTimetime
chronobabar::codec::chronochrono::NaiveDate / NaiveTime / NaiveDateTime / DateTime<Utc>chrono
numericbabar::codec::numericrust_decimal::Decimal ↔ Postgres numericrust_decimal
jsonbabar::codec::jsonserde_json::Value and typed_json::<T>() for Serialize + Deserializeserde, serde_json
arraybabar::codec::arrayarray(C) combinator for one-dimensional arraysfallible-iterator
rangebabar::codec::rangerange(C) combinator over discrete and continuous ranges
multirangebabar::codec::multirangemultirange(C) (Postgres 14+); implies range
intervalbabar::codec::intervalbabar::codec::Interval
netbabar::codec::netinet, cidr (IpAddr, Cidr)
macaddrbabar::codec::macaddrMacAddr, MacAddr8
bitsbabar::codec::bitsBitString for bit / varbit
hstorebabar::codec::hstoreHstore (BTreeMap<String, Option<String>>)
citextbabar::codec::citextStringcitext extension type
text-searchbabar::codec::text_searchTsVector, TsQuery
pgvectorbabar::codec::pgvectorVector for the pgvector extension
postgisbabar::codec::postgisgeometry::<T>() / geography::<T>() over geo-typesgeo-types

Pick what your schema actually uses. A common starting set for an HTTP service:

babar = { version = "...", features = ["rustls", "uuid", "time", "json", "numeric"] }

Default features

default = ["rustls"]. Disable defaults if you want to ship with native-tls, or with TLS off entirely:

babar = { version = "...", default-features = false, features = ["native-tls", "uuid"] }

babar-macros

The proc-macro crate (babar-macros, exposed via babar::Codec and babar::sql) currently exposes no cargo features of its own — it’s unconditionally on when you depend on babar.

Next

For the runtime configuration of TLS, see configuration.md. For Postgres types and the codec values they map to, see codecs.md.