Cargo Features

[dependencies]
libcoap-sys = { version = "0.2.2+libcoap-4.3.1", default-features = false, features = ["dtls", "dtls_backend_openssl", "dtls_backend_gnutls", "dtls_backend_mbedtls", "dtls_backend_tinydtls", "vendored", "static", "tcp", "async", "server", "client", "epoll"] }
default = async, client, epoll, server, static, tcp, vendored

The default features match those of libcoaps configure script, except for dtls, which is disabled here because it requires a backend to be set manually.

dtls dtls_backend_gnutls? dtls_backend_mbedtls? dtls_backend_openssl? dtls_backend_tinydtls?

While not specified here due to limitations in Cargo's syntax, the DTLS feature depends on one of the DTLS backends being enabled. If you are developing a library based on libcoap-sys and do not care about the DTLS backend, enable the dtls feature and let the user decide on the backend to use, either by re-exporting these features (see https://doc.rust-lang.org/cargo/reference/features.html#dependency-features) or by assuming that the user will use libcoap-sys as a dependency and enable the corresponding backend feature themselves, relying on Cargo's feature unification to enable it for your crate as well. Also note that the backends are mutually exclusive due to the C library having these backends as mutually exclusive features. If multiple backends are enabled (e.g. because multiple dependencies use libcoap-sys and use different backends), we select one based on the auto-detection order specified in https://github.com/obgm/libcoap/blob/develop/configure.ac#L494 (gnutls > openssl > mbedtls > tinydtls).

dtls_backend_openssl = dtls, openssl-sys
dtls_backend_gnutls = dtls, gnutls-sys
dtls_backend_mbedtls = dtls, mbedtls-sys-auto
dtls_backend_tinydtls = dtls, tinydtls-sys
vendored default = static

Enabling this feature will force libcoap-sys to be built with and statically linked to a vendored version of libcoap,
which will be built by the build-script before building libcoap-sys.
This way, it is no longer required to have libcoap installed to use this crate.

static default vendored

Enable this feature to use static linking to libcoap instead of dynamic linking.

tcp default

--- FEATURE FLAGS ---
Note that setting the feature flags currently has no effect on the generated Rust code, because the libcoap headers do not use these feature flags. They only affect the features built into the vendored C library (if enabled).
Enable this feature to support CoAP over TCP

async default

Enable this feature to enable async functionality in libcoap.
Note that this does not generate async-functions as they are used in Rust, just the necessary functions in the C library to make asynchronous requests.

server default

Enable this feature for server functionality.

client default

Enable this feature for client functionality.

epoll default

Enable this feature to enable epoll usage in the C library.

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

gnutls-sys dtls_backend_gnutls?
openssl-sys dtls_backend_openssl?
mbedtls-sys-auto dtls_backend_mbedtls?
tinydtls-sys dtls_backend_tinydtls?

Enables tinydtls-sys ^0.1.2