Crate gcore

source ·
Expand description

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.



extern crate galloc;

use gcore::msg;

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");

pub fn oom(_: core::alloc::Layout) -> ! {

fn panic(_: &core::panic::PanicInfo) -> ! {


  • pub use gear_stack_buffer as stack_buffer;


  • Type definitions and helpers for error handling.
  • Utility functions related to the current execution context or program execution flow.
  • Extensions for additional features.
  • Messaging API for Gear programs.
  • API for creating programs from Gear programs.


Type Aliases§