mycrush

Crates.iomycrush
lib.rsmycrush
version1.0.1
created_at2025-10-08 08:30:26.926304+00
updated_at2025-10-09 12:26:59.322104+00
descriptionRust implementation of the CRUSH (Controlled Replication Under Scalable Hashing) algorithm
homepagehttps://github.com/sevki/libcrush
repositoryhttps://github.com/sevki/libcrush
max_upload_size
id1873651
size220,475
Sevki (sevki)

documentation

README

🥰 mycrush

mycrush is a pure Rust implementation of the CRUSH algorithm, converted from C with c2rust and then refactored for safety and WASM compatibility.

Features

  • ✅ Pure Rust API - No C ABI compatibility layer
  • ✅ WASM Compatible - Builds for wasm32-unknown-unknown target
  • ✅ Safe Rust patterns - Uses Result types and safe abstractions where possible
  • ✅ No symbol conflicts - Independent from the C libcrush library
  • ✅ Modern error handling - CrushError enum instead of integer error codes

Building

# Regular build
cargo build --package mycrush

# WASM build
cargo build --package mycrush --target wasm32-unknown-unknown --release

# Run tests
cargo test --package mycrush

Status

The library has been successfully converted to a pure Rust implementation:

  • All #[unsafe(no_mangle)] and extern "C" declarations removed
  • Safe Rust implementations for helper functions
  • WASM compatibility verified
  • All tests passing

For detailed conversion notes, see PURE_RUST_CONVERSION.md.

Note

This library still uses some internal libc functions (malloc/free/memcpy/memset) but is WASM-compatible through the libc crate's WASM support. Future work will replace these with pure Rust alternatives.

Commit count: 0

cargo fmt