例 - 標準出力への書き込み
初期化
#[no_mangle]
unsafe extern "C" fn _pen_os_write_stdout(
stack: &mut ffi::cps::AsyncStack,
continue_: ffi::cps::ContinuationFunction<ffi::Arc<FfiResult<ffi::Number>>>,
bytes: ffi::ByteString,
) -> ffi::cps::Result {
let mut future: WriteStdoutFuture = Box::pin(utilities::write(stdout(), bytes));
match future.as_mut().poll(stack.context().unwrap()) {
Poll::Ready(value) => continue_(stack, ffi::Arc::new(value.into())),
Poll::Pending => {
stack.suspend(_pen_os_write_stdout_poll, continue_, future);
ffi::cps::Result::new()
}
}
}