vowpalwabbit-sys 8.6.1-beta

Rust bindings for VowpalWabbit
docs.rs failed to build vowpalwabbit-sys-8.6.1-beta
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: vowpalwabbit-sys-8.8.1+vw-v8.8.0

Rust bindings for the VowpalWabbit C-binding surface.

Note: Currently this crate only supports discovering VW through pkg-config, therefore VowpalWabbit must be installed using make install for this crate to be able to find it and link to it. This crate is not yet supported on Windows, once VW supports Vcpkg then this crate will use that to discover it.

In order to get the library installed:

  1. Clone VowpalWabbit
  2. mkdir build
  3. cd build
  4. make -j 8
  5. make install

Example

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);
}