Crate unqlite_sys [] [src]

Rust bindings for UnQlite library.

travis-badge release-badge downloads docs-badge license-badge

As its official site says, UnQlite is

An Embeddable NoSQL Database Engine.

Please see UnQLite C/C++ API Reference for full API documents.

Usage

This crate provides several features for UnQlite compile-time options:

  • enable-threads: equivalent to UNQLITE_ENABLE_THREADS enabled.
  • jx9-disable-builtin-func: equivalent to JX9_DISABLE_BUILTIN_FUNC enabled.
  • jx9-enable-math-fuc: equivalent to JX9_ENABLE_MATH_FUNC enabled.
  • jx9-disable-disk-io: equivalent to JX9_DISABLE_DISK_IO enabled.
  • enable-jx9-hash-io: equivalent to UNQLITE_ENABLE_JX9_HASH_IO enabled.

To provide the same default behavior as original C does, non of the features is enabled by default. When you want some features, such as enable-threads, just config in Cargo.toml:

[dependencies.unqlite-sys]
version = "0.3"
features = [ "enable-threads" ]

For multiple features just add them in toml features array.

Threadsafe

Note that even "enable-threads" is featured in your crate, it's not meant that your code is threadsafe.

When UnQLite has been compiled with threading support then the threading mode can be altered at run-time using the unqlite_lib_config() interface together with one of these verbs:

UNQLITE_LIB_CONFIG_THREAD_LEVEL_SINGLE

UNQLITE_LIB_CONFIG_THREAD_LEVEL_MULTI

Platforms others than Windows and UNIX systems must install their own mutex subsystem via unqlite_lib_config() with a configuration verb set to UNQLITE_LIB_CONFIG_USER_MUTEX. Otherwise the library is not threadsafe.

Note that you must link UnQLite with the POSIX threads library under UNIX systems (i.e: -lpthread).

To use in multithread cases, that is threadsafe, you may use like this:

extern crate unqlite_sys as ffi;
use ffi::constants as ffic;

fn main() {
    unsafe {
        ffi::unqlite_lib_config(ffic::UNQLITE_LIB_CONFIG_THREAD_LEVEL_MULTI);
        ffi::unqlite_lib_init();
        assert_eq!(ffi::unqlite_lib_is_threadsafe(), 1);

        // do stuff ...

    }
}

Modules

constants

Structs

Struct_SyMemMethods
Struct_SyMutexMethods
Struct_SyString
Struct_Sytm
Struct___va_list_tag
Struct_syiovec
Struct_unqlite_file
Struct_unqlite_io_methods
Struct_unqlite_kv_cursor
Struct_unqlite_kv_engine
Struct_unqlite_kv_io
Struct_unqlite_kv_methods
Struct_unqlite_page
Struct_unqlite_vfs

Enums

Struct_SyMutex
Struct_jx9_context
Struct_jx9_io_stream
Struct_jx9_value
Struct_unqlite
Struct_unqlite_vm

Functions

unqlite_array_add_elem
unqlite_array_add_strkey_elem
unqlite_array_count
unqlite_array_fetch
unqlite_array_walk
unqlite_begin
unqlite_close
unqlite_commit
unqlite_compile
unqlite_compile_file
unqlite_config
unqlite_context_alloc_chunk
unqlite_context_free_chunk
unqlite_context_new_array
unqlite_context_new_scalar
unqlite_context_output
unqlite_context_output_format
unqlite_context_peek_aux_data
unqlite_context_push_aux_data
unqlite_context_random_num
unqlite_context_random_string
unqlite_context_realloc_chunk
unqlite_context_release_value
unqlite_context_result_buf_length
unqlite_context_throw_error
unqlite_context_throw_error_format
unqlite_context_user_data
unqlite_create_constant
unqlite_create_function
unqlite_delete_constant
unqlite_delete_function
unqlite_function_name
unqlite_kv_append
unqlite_kv_append_fmt
unqlite_kv_config
unqlite_kv_cursor_data
unqlite_kv_cursor_data_callback
unqlite_kv_cursor_delete_entry
unqlite_kv_cursor_first_entry
unqlite_kv_cursor_init
unqlite_kv_cursor_key
unqlite_kv_cursor_key_callback
unqlite_kv_cursor_last_entry
unqlite_kv_cursor_next_entry
unqlite_kv_cursor_prev_entry
unqlite_kv_cursor_release
unqlite_kv_cursor_reset
unqlite_kv_cursor_seek
unqlite_kv_cursor_valid_entry
unqlite_kv_delete
unqlite_kv_fetch
unqlite_kv_fetch_callback
unqlite_kv_store
unqlite_kv_store_fmt
unqlite_lib_config
unqlite_lib_copyright
unqlite_lib_ident
unqlite_lib_init
unqlite_lib_is_threadsafe
unqlite_lib_shutdown
unqlite_lib_signature
unqlite_lib_version
unqlite_open
unqlite_result_bool
unqlite_result_double
unqlite_result_int
unqlite_result_int64
unqlite_result_null
unqlite_result_resource
unqlite_result_string
unqlite_result_string_format
unqlite_result_value
unqlite_rollback
unqlite_util_load_mmaped_file
unqlite_util_random_num
unqlite_util_random_string
unqlite_util_release_mmaped_file
unqlite_value_bool
unqlite_value_compare
unqlite_value_double
unqlite_value_int
unqlite_value_int64
unqlite_value_is_bool
unqlite_value_is_callable
unqlite_value_is_empty
unqlite_value_is_float
unqlite_value_is_int
unqlite_value_is_json_array
unqlite_value_is_json_object
unqlite_value_is_null
unqlite_value_is_numeric
unqlite_value_is_resource
unqlite_value_is_scalar
unqlite_value_is_string
unqlite_value_null
unqlite_value_release
unqlite_value_reset_string_cursor
unqlite_value_resource
unqlite_value_string
unqlite_value_string_format
unqlite_value_to_bool
unqlite_value_to_double
unqlite_value_to_int
unqlite_value_to_int64
unqlite_value_to_resource
unqlite_value_to_string
unqlite_vm_config
unqlite_vm_dump
unqlite_vm_exec
unqlite_vm_extract_variable
unqlite_vm_new_array
unqlite_vm_new_scalar
unqlite_vm_release
unqlite_vm_release_value
unqlite_vm_reset

Type Definitions

ProcConsumer
ProcMemError
SyMemMethods
SyMutex
SyMutexMethods
SyString
Sytm
__builtin_va_list
__gnuc_va_list
pgno
sxi64
sxu64
syiovec
unqlite
unqlite_context
unqlite_file
unqlite_int64
unqlite_io_methods
unqlite_io_stream
unqlite_kv_cursor
unqlite_kv_engine
unqlite_kv_handle
unqlite_kv_io
unqlite_kv_methods
unqlite_page
unqlite_real
unqlite_value
unqlite_vfs
unqlite_vm
va_list