DevCycle Bucketing Library - Multi-Platform Support
This library has been configured to build as:
- Rust library - for use in Rust projects
- C library (FFI) - for use in C/C++ applications
- WebAssembly (WASM) - for use in web browsers and Node.js
Rust Library
target/release/libdevcycle_bucketing_rs.rlib- Rust static library- Use in Rust projects via
Cargo.tomldependencies
C Library (FFI)
target/release/libdevcycle_bucketing_rs.a- Static library (39MB)target/release/libdevcycle_bucketing_rs.dylib- Dynamic library for macOS (2.7MB)target/release/libdevcycle_bucketing_rs.so- Dynamic library for Linuxtarget/release/libdevcycle_bucketing_rs.dll- Dynamic library for Windowsdevcycle_bucketing.h- C header file (generated with cbindgen)
WebAssembly
pkg-web/- WASM package for web browserspkg-node/- WASM package for Node.jspkg-bundler/- WASM package for webpack/rollup/etc.
Usage Examples
Rust
use ;
use HashMap;
async
C/C++
int
Compile with:
JavaScript (Web)
import init from './pkg-web/devcycle_bucketing_rs.js';
JavaScript (Node.js)
const = require;
.;
Dependencies
For C Library
- Install cbindgen to generate headers:
cargo install cbindgen
For WebAssembly
- Install wasm-pack:
|
Features
The library supports conditional compilation via Cargo features:
ffi- Enable FFI bindings for C librarywasm- Enable WebAssembly bindings
Build with specific features:
Project Structure
src/
├── lib.rs # Main library entry point
├── ffi.rs # C FFI bindings (feature: ffi)
├── wasm.rs # WASM bindings (feature: wasm)
├── bucketing/ # Core bucketing logic
├── config/ # Configuration management
├── events/ # Event queue system
├── segmentation/ # User segmentation
├── user/ # User data structures
└── util/ # Utilities
Documentation
For detailed build instructions, see BUILD.md
Testing
Run tests:
Size Information
The release builds are optimized for size, especially for WASM:
- C static library: ~39 MB
- C dynamic library (macOS): ~2.7 MB
- WASM package: Optimized with LTO
Platform Support
- Rust: All platforms supported by Rust
- C Library: Linux, macOS, Windows (x86_64, ARM64)
- WebAssembly: Modern browsers, Node.js 14+