Type Alias mongocrypt_sys::mongocrypt_binary_t

source ·
pub type mongocrypt_binary_t = _mongocrypt_binary_t;
Expand description

A non-owning view of a byte buffer.

When constructing a mongocrypt_binary_t it is the responsibility of the caller to maintain the lifetime of the viewed data. However, all public functions that take a mongocrypt_binary_t as an argument will make a copy of the viewed data. For example, the following is valid:

@code{.c} mongocrypt_binary_t bin = mongocrypt_binary_new_from_data(mydata, mylen); assert (mongocrypt_setopt_kms_provider_local (crypt), bin); // The viewed data of bin has been copied. Ok to free the view and the data. mongocrypt_binary_destroy (bin); my_free_fn (mydata); @endcode

Functions with a mongocrypt_binary_t* out guarantee the lifetime of the viewed data to live as long as the parent object. For example, @ref mongocrypt_ctx_mongo_op guarantees that the viewed data of mongocrypt_binary_t is valid until the parent ctx is destroyed with @ref mongocrypt_ctx_destroy.

The mongocrypt_binary_t struct definition is public. Consumers may rely on the struct layout.

Aliased Type§

struct mongocrypt_binary_t {
    pub data: *mut c_void,
    pub len: u32,
}

Fields§

§data: *mut c_void§len: u32