#[repr(C)]pub struct _mongocrypt_binary_t {
pub data: *mut c_void,
pub len: u32,
}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.
Fields§
§data: *mut c_void§len: u32Trait Implementations§
Source§impl Clone for _mongocrypt_binary_t
impl Clone for _mongocrypt_binary_t
Source§fn clone(&self) -> _mongocrypt_binary_t
fn clone(&self) -> _mongocrypt_binary_t
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more