Skip to main content

Crate libcronet_sys

Crate libcronet_sys 

Source
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_DIR at 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-static for automatic static downloads, or the legacy download feature for either backend, to fetch and checksum a prebuilt from https://github.com/rust-proxy/cronet-binaries into OUT_DIR. Then load it via load_downloaded_library (dynamic) — the path is also available via downloaded_library_path.

Structs§

Library
A loaded dynamic library.
RawBidirectionalStream
Opaque handle to a bidirectional_stream.
RawBidirectionalStreamCallback
Raw callback struct for bidirectional_stream.
RawBidirectionalStreamHeader
Header struct for bidirectional_stream.
RawBidirectionalStreamHeaderArray
Header array struct.
RawCertVerifier
Opaque handle to a CertVerifier.
RawEngine
Opaque handle to a Cronet_Engine object.
RawEngineParams
Opaque handle to a Cronet_EngineParams object.
RawStreamEngine
Opaque handle to a stream_engine (bidirectional stream engine).

Constants§

STATIC_LINKED
Whether this build links Cronet into the executable.

Functions§

Cronet_CreateCertVerifierWithRootCerts⚠
Cronet_EngineParams_Create⚠
Cronet_EngineParams_Destroy⚠
Cronet_EngineParams_enable_brotli_set⚠
Cronet_EngineParams_enable_http2_set⚠
Cronet_EngineParams_enable_quic_set⚠
Cronet_EngineParams_experimental_options_set⚠
Cronet_EngineParams_http_cache_max_size_set⚠
Cronet_EngineParams_http_cache_mode_set⚠
Cronet_EngineParams_user_agent_set⚠
Cronet_Engine_CloseAllConnections⚠
Cronet_Engine_Create⚠
Cronet_Engine_Destroy⚠
Cronet_Engine_GetDefaultUserAgent⚠
Cronet_Engine_GetStreamEngine⚠
Cronet_Engine_GetVersionString⚠
Cronet_Engine_SetDialer⚠
Cronet_Engine_SetMockCertVerifierForTesting⚠
Cronet_Engine_SetUdpDialer⚠
Cronet_Engine_Shutdown⚠
Cronet_Engine_StartWithParams⚠
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 None when 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. Returns None if no candidate with a loadable extension for this OS is found.
load_downloaded_library⚠
Load the prebuilt library that build.rs downloaded (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).
RawUdpDialer
UDP dialer callback returning a native socket or negative net error. On success, write the local endpoint and an ID (zero disables close notification).
RawUdpSocketClose
Optional notification for a nonzero ID returned by the UDP dialer.