Crates.io | vowpalwabbit-sys |
lib.rs | vowpalwabbit-sys |
version | 8.8.1+vw-v8.8.0 |
source | src |
created_at | 2019-06-02 17:42:13.759335 |
updated_at | 2020-02-02 01:59:14.682053 |
description | Rust bindings for VowpalWabbit |
homepage | |
repository | https://github.com/jackgerrits/vowpalwabbit-sys-rs |
max_upload_size | |
id | 138534 |
size | 36,614,907 |
This crate wraps VowpalWabbit's C binding interface. This crate wraps all of the dependencies and builds from source on each platform. For details about how the dependencies are configured see here.
See vowpalwabbit-rs for the Rust wrapper around the sys package. This is still a work in progress.
The major and minor versions of this crate track that of the native VW library that is wraps. The patch version, though, may be out of sync due to the need to patch the crate out of sync with the native dependency. Starting at version 8.8.1+vw-v8.8.0
you can determine the version of Vowpal Wabbit that it wraps by looking at the associated SemVer metadata. In this case it is vw-v8.8.0
indicating the wrapped Vowpal Wabbit version is 8.8.0
.
The following is an example for a basic usecase similar to command line driver mode. VW is initialized, an example run through the parser then prediction pipeline. Finally the example and VW object are finished.
use std::ffi::CString;
unsafe {
let command_line_str = CString::new("--quiet").unwrap();
let vw_handle = vowpalwabbit_sys::VW_InitializeA(command_line_str.as_ptr());
let example_str =
CString::new("1 | test example=1").unwrap();
let example_handle = vowpalwabbit_sys::VW_ReadExampleA(vw_handle, example_str.as_ptr());
vowpalwabbit_sys::VW_Predict(vw_handle, example_handle);
vowpalwabbit_sys::VW_Learn(vw_handle, example_handle);
vowpalwabbit_sys::VW_FinishExample(vw_handle, example_handle);
vowpalwabbit_sys::VW_Finish(vw_handle);
}