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() -> Result<(), Box<dyn Error>> {
    let mut context = Context::new();
    let input = context.input_get()?;
    let value: i32 = Deserialize::deserialize(&input)?;
    value.serialize(&mut context)?;
    context.finalize_output()?;
    Ok(())
}

Re-exports§

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

Modules§

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.