pebble-sys 0.0.1

Low-level FFI bindings for Pebble (watch) SDK 4.3
Documentation
  • Coverage
  • 9.74%
    15 out of 154 items documented0 out of 22 items with examples
  • Size
  • Source code size: 36.56 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 5.75 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Tamschi/pebble-sys
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Tamschi

pebble-sys

Lib.rs Crates.io Docs.rs

Rust nightly-2020-10-30 Build Status Crates.io - License

GitHub open issues open pull requests crev reviews

Low-level FFI bindings for Pebble (watch) SDK 4.3.

I recommend using the high-level wrapper in pebble-skip instead, since it provides almost the same functionality with full memory safety and with very little overhead.

This crate is still heavily work in progress, so expect frequent breaking changes and missing functionality before 0.1. If you'd like me to prioritise a specific API, please file a feature request on GitHub.

Installation

Please use cargo-edit to always add the latest version of this library:

cargo add pebble-sys

Example

#![no_std]

use pebble_sys::{
  foundation::app::app_event_loop,
  standard_c::memory::{c_str, void},
  user_interface::{
    window::number_window::{
      number_window_create, number_window_get_window_mut, number_window_set_value,
      NumberWindowCallbacks,
    },
    window_stack::window_stack_push,
  },
};

#[no_mangle]
pub extern "C" fn main() -> i32 {
  static mut CONTEXT: () = ();

  unsafe {
    let label = &*("miles to see you\0" as *const _ as *const c_str);
    let number_window = number_window_create(
      label,
      NumberWindowCallbacks {
        incremented: None,
        decremented: None,
        selected: None,
      },
      &mut *(&mut CONTEXT as *mut _ as *mut void),
    )
    .unwrap();
    number_window_set_value(number_window, 10_000);
    let window = number_window_get_window_mut(number_window);
    window_stack_push(window, true);
    app_event_loop();
    0
  }
}

License

Licensed under either of

at your option.

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.

Code of Conduct

Changelog

Versioning

pebble-sys strictly follows Semantic Versioning 2.0.0 with the following exceptions:

  • The minor version will not reset to 0 on major version changes (except for v1).
    Consider it the global feature level.
  • The patch version will not reset to 0 on major or minor version changes (except for v0.1 and v1).
    Consider it the global patch level.

This includes the Rust version requirement specified above.
Earlier Rust versions may be compatible, but this can change with minor or patch releases.

Which versions are affected by features and patches can be determined from the respective headings in CHANGELOG.md.