#![no_std]
#![no_main]
extern crate alloc;
use alloc::string::String;
use core::sync::atomic::{AtomicI32, Ordering};
use hyperlight_guest_bin::error::Result;
use hyperlight_guest_bin::{guest_function, host_function};
static COUNTER: AtomicI32 = AtomicI32::new(0);
#[host_function("GetWeekday")]
fn get_weekday() -> Result<String>;
#[guest_function("SayHello")]
fn say_hello(name: String) -> Result<String> {
let weekday = get_weekday()?;
Ok(alloc::format!("Hello, {name}! Today is {weekday}."))
}
#[guest_function("Add")]
fn add(a: i32, b: i32) -> Result<i32> {
Ok(a + b)
}
#[guest_function("Increment")]
fn increment() -> Result<i32> {
let old = COUNTER.fetch_add(1, Ordering::Relaxed);
Ok(old + 1)
}