Function tskit::bindings::kastore_oput

source ·
pub unsafe extern "C" fn kastore_oput(
    self_: *mut kastore_t,
    key: *const c_char,
    key_len: usize,
    array: *mut c_void,
    array_len: usize,
    type_: c_int,
    flags: c_int
) -> c_int
Expand description

@brief Insert the specified key-array pair into the store, transferring ownership of the malloced array buffer to the store (own-put).

@rst A key with the specified length is inserted into the store and associated with an array of the specified type and number of elements. The contents of the specified key is copied, but the array buffer is taken directly and freed when the store is closed. The array buffer must be a pointer returned by malloc or calloc. Ownership of the buffer is not taken unless the function returns successfully.

Apart from taking ownership of the array buffer, the semantics of this function are identical to :c:func:kastore_put. @endrst

@param self A pointer to a kastore object. @param key The key. @param key_len The length of the key. @param array The array. Must be a pointer returned by malloc/calloc. @param array_len The number of elements in the array. @param type The type of the array. @param flags The insertion flags. Currently unused. @return Return 0 on success or a negative value on failure.