libdivecomputer-sys 0.1.0

Unsafe bindings for libdivecomputer
Documentation
  • Coverage
  • 10.89%
    70 out of 643 items documented0 out of 32 items with examples
  • Size
  • Source code size: 2.36 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 22.66 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3m 29s Average build duration of successful builds.
  • all releases: 3m 29s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • theCarlG/libdivecomputer-rs
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • theCarlG

🧭 libdivecomputer-sys

Unsafe automatically-generated Rust bindings for libdivecomputer.

Build Status Crates.io Docs

Please also see the repository containing a work-in-progress safe wrapper.

Basic usage

unsafe {
    let mut iterator: *mut dc_iterator_t = ptr::null_mut();
    let mut descriptor: *mut dc_descriptor_t = ptr::null_mut();

    dc_descriptor_iterator(&mut iterator);
    while dc_iterator_next(iterator, &mut descriptor as *mut _ as *mut c_void)
        == dc_status_t_DC_STATUS_SUCCESS
    {
        let vendor = CStr::from_ptr(dc_descriptor_get_vendor(descriptor));
        let product = CStr::from_ptr(dc_descriptor_get_product(descriptor));

        println!("{} {}", vendor.to_string_lossy(), product.to_string_lossy());

        dc_descriptor_free(descriptor);
    }
    dc_iterator_free(iterator);
}

License

Licensed under either of

at your option.

Note that libdivecomputer has its own LGPL-2.1 license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.