#[repr(C)]pub struct __wt_collator {
pub compare: Option<unsafe extern "C" fn(collator: *mut WT_COLLATOR, session: *mut WT_SESSION, key1: *const WT_ITEM, key2: *const WT_ITEM, cmp: *mut c_int) -> c_int>,
pub customize: Option<unsafe extern "C" fn(collator: *mut WT_COLLATOR, session: *mut WT_SESSION, uri: *const c_char, passcfg: *mut WT_CONFIG_ITEM, customp: *mut *mut WT_COLLATOR) -> c_int>,
pub terminate: Option<unsafe extern "C" fn(collator: *mut WT_COLLATOR, session: *mut WT_SESSION) -> c_int>,
}Expand description
The interface implemented by applications to provide custom ordering of records.
Applications register their implementation with WiredTiger by calling WT_CONNECTION::add_collator. See @ref custom_collators for more information.
@snippet ex_extending.c add collator nocase
@snippet ex_extending.c add collator prefix10
Fields§
§compare: Option<unsafe extern "C" fn(collator: *mut WT_COLLATOR, session: *mut WT_SESSION, key1: *const WT_ITEM, key2: *const WT_ITEM, cmp: *mut c_int) -> c_int>Callback to compare keys.
@param[out] cmp set to -1 if key1 < key2,
0 if key1 == key2,
1 if key1 > key2.
@returns zero for success, non-zero to indicate an error.
@snippet ex_all.c Implement WT_COLLATOR
@snippet ex_extending.c case insensitive comparator
@snippet ex_extending.c n character comparator
customize: Option<unsafe extern "C" fn(collator: *mut WT_COLLATOR, session: *mut WT_SESSION, uri: *const c_char, passcfg: *mut WT_CONFIG_ITEM, customp: *mut *mut WT_COLLATOR) -> c_int>If non-NULL, this callback is called to customize the collator for each data source. If the callback returns a non-NULL collator, that instance is used instead of this one for all comparisons.
terminate: Option<unsafe extern "C" fn(collator: *mut WT_COLLATOR, session: *mut WT_SESSION) -> c_int>If non-NULL a callback performed when the data source is closed for customized extractors otherwise when the database is closed.
The WT_COLLATOR::terminate callback is intended to allow cleanup, the handle will not be subsequently accessed by WiredTiger.
Trait Implementations§
Source§impl Clone for __wt_collator
impl Clone for __wt_collator
Source§fn clone(&self) -> __wt_collator
fn clone(&self) -> __wt_collator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more