Expand description
Raw FFI bindings for the Chromium Cronet C API (libcronet).
dynamic takes precedence over static-link on every target, so one feature
combination always selects the same backend. Desktop and Android targets load
Cronet at runtime by default and link the archive only with static-link.
Apple targets link the archive by default; enabling dynamic there switches to
runtime loading, which requires a user-supplied shared library (no shared
Cronet build is released for macOS, and iOS/tvOS support none at all).
§Obtaining the native library
The native library is not vendored. Provide it one of three ways:
- point
CRONET_LIB_DIRat a directory containing it (static mode), or - place a loadable
libcronet.{so,dll,dylib}on the system search path (dynamic mode), or - enable
static-link,download-staticfor automatic static downloads, or the legacydownloadfeature for either backend, to fetch and checksum a prebuilt from https://github.com/rust-proxy/cronet-binaries intoOUT_DIR. Then load it viaload_downloaded_library(dynamic) — the path is also available viadownloaded_library_path.
Structs§
- Library
- A loaded dynamic library.
- RawBidirectional
Stream - Opaque handle to a
bidirectional_stream. - RawBidirectional
Stream Callback - Raw callback struct for
bidirectional_stream. - RawBidirectional
Stream Header - Header struct for
bidirectional_stream. - RawBidirectional
Stream Header Array - Header array struct.
- RawCert
Verifier - Opaque handle to a
CertVerifier. - RawEngine
- Opaque handle to a
Cronet_Engineobject. - RawEngine
Params - Opaque handle to a
Cronet_EngineParamsobject. - RawStream
Engine - Opaque handle to a
stream_engine(bidirectional stream engine).
Constants§
- STATIC_
LINKED - Whether this build links Cronet into the executable.
Functions§
- Cronet_
Create ⚠Cert Verifier With Root Certs - Cronet_
Engine ⚠Params_ Create - Cronet_
Engine ⚠Params_ Destroy - Cronet_
Engine ⚠Params_ enable_ brotli_ set - Cronet_
Engine ⚠Params_ enable_ http2_ set - Cronet_
Engine ⚠Params_ enable_ quic_ set - Cronet_
Engine ⚠Params_ experimental_ options_ set - Cronet_
Engine ⚠Params_ http_ cache_ max_ size_ set - Cronet_
Engine ⚠Params_ http_ cache_ mode_ set - Cronet_
Engine ⚠Params_ user_ agent_ set - Cronet_
Engine_ ⚠Close AllConnections - Cronet_
Engine_ ⚠Create - Cronet_
Engine_ ⚠Destroy - Cronet_
Engine_ ⚠GetDefault User Agent - Cronet_
Engine_ ⚠GetStream Engine - Cronet_
Engine_ ⚠GetVersion String - Cronet_
Engine_ ⚠SetDialer - Cronet_
Engine_ ⚠SetMock Cert Verifier ForTesting - Cronet_
Engine_ ⚠SetUdp Dialer - Cronet_
Engine_ ⚠Shutdown - Cronet_
Engine_ ⚠Start With Params - bidirectional_
stream_ ⚠cancel - bidirectional_
stream_ ⚠create - bidirectional_
stream_ ⚠delay_ request_ headers_ until_ flush - bidirectional_
stream_ ⚠destroy - bidirectional_
stream_ ⚠disable_ auto_ flush - bidirectional_
stream_ ⚠flush - bidirectional_
stream_ ⚠read - bidirectional_
stream_ ⚠start - bidirectional_
stream_ ⚠write - conflicting_
library - If an explicit file, directory or loader search name selects a different library, return the path of the one already in use. Never load the requested library here.
- downloaded_
library_ path - Path to the verified archive or shared library selected by the downloader,
or
Nonewhen the build used no downloaded asset. - find_
platform_ library - Recursively search
dir(and its sub-directories) for the loadable library that best matches the current platform, returning its full path. ReturnsNoneif no candidate with a loadable extension for this OS is found. - load_
downloaded_ ⚠library - Load the prebuilt library that
build.rsdownloaded (dynamic mode). - load_
library ⚠ - Load the libcronet shared library at runtime.
- loaded_
library_ path - Filesystem path reported by the OS for the active Cronet module.
Type Aliases§
- RawDialer
- TCP dialer callback: returns fd (or negative net_error).
- RawUdp
Dialer - UDP dialer callback returning a native socket or negative net error. On success, write the local endpoint and an ID (zero disables close notification).
- RawUdp
Socket Close - Optional notification for a nonzero ID returned by the UDP dialer.