Crate shopify_function_wasm_api

Crate shopify_function_wasm_api 

Source
Expand description

§Shopify Function Wasm API

This crate provides a high-level API for interfacing with the Shopify Function Wasm API.

§Usage

use shopify_function_wasm_api::{Context, Serialize, Deserialize, Value};
use std::error::Error;

fn main() {
    run().unwrap();
}

fn run() -> Result<(), Box<dyn Error>> {
    shopify_function_wasm_api::init_panic_handler();
    let mut context = Context::new();
    let input = context.input_get()?;
    let value: i32 = Deserialize::deserialize(&input)?;
    value.serialize(&mut context)?;
    Ok(())
}

Re-exports§

pub use read::Deserialize;
pub use write::Serialize;

Modules§

log
The log API for the Shopify Function Wasm API.
read
The read API for the Shopify Function Wasm API.
write
The write API for the Shopify Function Wasm API.

Structs§

CachedInternedStringId
A mechanism for caching interned string IDs.
Context
A context for reading and writing values.
InternedStringId
An identifier for an interned UTF-8 string.
Value
A value read from the input.

Enums§

ContextError
An error that can occur when creating a Context.

Functions§

init_panic_handler
Configures panics to write to the logging API.