Futures, streams and error contexts, and async functions.
Types
use resource canvas
from kitchen-sink:types/resources@0.1.0
A resource with every kind of member.
constructor(width: u32, height: u32)Makes an empty canvas.
plot: func(at: point, color: list<u8, 4>)A method.
copy-from: func(other: borrow<canvas>) -> result<_, string>A method that borrows another canvas.
snapshot: func() -> canvasA method that hands back a resource it owns.
render: async func() -> list<u8>An async method.
open: static func(path: string) -> result<canvas, string>A static function.
load: static async func(url: string) -> result<canvas, string>A static async function.
title: get() -> stringA property with a getter and a setter.
title: set(value: string)area: get() -> u64A property with a getter alone.
max-size: static get() -> u32A static property.
max-size: static set(value: u32) -> result<_, string>
type signal
future
type eventually
future<result<string, error-context>>
type ticks
stream
type bytes
stream<u8>
type frames
stream<canvas>
type failure
error-context
Functions
fetch: async func(url: string) -> result<list<u8>, error-context>
An async function.
watch: func(path: string) -> tuple<stream<string>, future<result>>
A function that returns a stream and a future of its end.
tick: func()
A function with neither params nor results.
wait: async func()
An async function with neither params nor results.
WIT
/// Futures, streams and error contexts, and async functions.
interface concurrency {
use resources.{canvas};
type signal = future;
type eventually = future<result<string, error-context>>;
type ticks = stream;
type bytes = stream<u8>;
type frames = stream<canvas>;
type failure = error-context;
/// An async function.
fetch: async func(url: string) -> result<list<u8>, error-context>;
/// A function that returns a stream and a future of its end.
watch: func(path: string) -> tuple<stream<string>, future<result>>;
/// A function with neither params nor results.
tick: func();
/// An async function with neither params nor results.
wait: async func();
}