38 releases (stable)

Uses new Rust 2024

1.10.0 Dec 2, 2025
1.9.2 Oct 3, 2025
1.9.1 Sep 5, 2025
1.8.1 May 15, 2025
0.0.1 Jul 6, 2021

#14 in #no-mangle

Download history 763/week @ 2025-10-13 1021/week @ 2025-10-20 759/week @ 2025-10-27 574/week @ 2025-11-03 738/week @ 2025-11-10 851/week @ 2025-11-17 782/week @ 2025-11-24 1089/week @ 2025-12-01 903/week @ 2025-12-08 765/week @ 2025-12-15 858/week @ 2025-12-22 474/week @ 2025-12-29 708/week @ 2026-01-05 642/week @ 2026-01-12 935/week @ 2026-01-19 796/week @ 2026-01-26

3,171 downloads per month
Used in 14 crates (2 directly)

GPL-3.0 license

210KB
3K SLoC

Contains (static library, 1KB) libgcore_shim.a

gcore

Core library for Gear programs.

Features

codec - Allows you to get actual errors occurred instead of ExtError::Some one.


lib.rs:

Lightweight library for use in Gear programs.

This library should be used as a standard library when writing Gear programs. Compared to gstd crate, this library provides lower-level primitives that allow you to develop less expensive programs. Choose it if you are ready to write more code but get a more efficient Wasm.

Note that you are to define panic and out-of-memory handlers, as the crate does not provide them by default.

Examples

#![no_std]
#![feature(alloc_error_handler)]

extern crate galloc;

use gcore::msg;

#[unsafe(no_mangle)]
extern "C" fn handle() {
    let mut bytes = [0; 64];
    msg::read(&mut bytes).expect("Unable to read");
    if let Ok(payload) = core::str::from_utf8(&bytes) {
        if payload == "PING" {
            msg::reply(b"PONG", 0).expect("Unable to reply");
        }
    }
}

#[alloc_error_handler]
pub fn oom(_: core::alloc::Layout) -> ! {
    core::arch::wasm32::unreachable()
}

#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! {
    core::arch::wasm32::unreachable()
}

Dependencies

~5MB
~110K SLoC