packagecomponentized:constants@0.2.0;
interfaceatomics {
/// Incrementing integers. Stream closes when it reaches max int./// @expression |v| v + 1incrementer: asyncfunc(seed: u64) -> stream<u64>;
/// Decrementing integers. Stream closes when it reaches zero./// @expression |v| v - 1decrementer: asyncfunc(seed: u64) -> stream<u64>;
}
/// Constant config values for the `wasi:config/store` interface.interfaceconfig-values {
/// Values to be exposed via the `wasi:config/store` interface.////// Either use this interface with custom override values, or duplicate/// this interface updating the default values defined below./// @value []values: func() -> list<tuple<string, string>>;
}
/// Creates components whose exported functions return constant values.interfacefactory {
usecomponentized:component/types@0.1.0.{wasm, error-code};
usecomponentized:component/wit@0.1.0.{wit, wit-source};
/// Values replacing those from the WIT. The overrides are a record with/// an optional field per world export. Interface exports are named by the/// interface and hold a nested record with a field per function.variantoverrides {
/// The record as WAVE source, `//` line comments are allowed.wave(string),
}
/// Creates a component implementing `world` from `wit`.////// Every function the world exports must take no parameters and return a/// value. Values can't reach maps, handles, futures, streams or error/// contexts, though result types may include them in branches the value/// doesn't take, e.g. `none` for an `option<own<r>>`. A function may/// return a stream, written as a list of its items, which must be an/// async function unless the stream is empty. Each function's value is a/// WAVE expression following a `@value` tag in its doc comment. A stream/// may continue with items generated by a Rust closure following an/// `@expression` tag, e.g. `|a, b| a + b`, from the items before them,/// starting from either its `@value` or the function's arguments.////// - `world`: the world to implement, required when the WIT package/// defines more than one world./// - `overrides`: values replacing those from the WIT.create: asyncfunc(wit: wit-source, %world: option<string>, overrides: option<overrides>) -> result<wasm, error-code>;
}
/// Common mathematical constants and sequences.interfacemath {
/// Euler's number (e)/// @value 2.718281828459045e: func() -> f64;
/// The Euler-Mascheroni constant (γ)/// @value 0.5772156649015329euler-gamma: func() -> f64;
/// 1/π/// @value 0.3183098861837907frac-n1-pi: func() -> f64;
/// 1/sqrt(2)/// @value 0.7071067811865476frac-n1-sqrt-n2: func() -> f64;
/// 2/π/// @value 0.6366197723675814frac-n2-pi: func() -> f64;
/// 2/sqrt(π)/// @value 1.1283791670955126frac-n2-sqrt-pi: func() -> f64;
/// π/2/// @value 1.5707963267948966frac-pi-n2: func() -> f64;
/// π/3/// @value 1.0471975511965979frac-pi-n3: func() -> f64;
/// π/4/// @value 0.7853981633974483frac-pi-n4: func() -> f64;
/// π/6/// @value 0.5235987755982989frac-pi-n6: func() -> f64;
/// π/8/// @value 0.39269908169872414frac-pi-n8: func() -> f64;
/// The golden ratio (φ)/// @value 1.618033988749895golden-ratio: func() -> f64;
/// ln(2)/// @value 0.6931471805599453ln-n2: func() -> f64;
/// ln(10)/// @value 2.302585092994046ln-n10: func() -> f64;
/// log2(10)/// @value 3.321928094887362log2-n10: func() -> f64;
/// log2(e)/// @value 1.4426950408889634log2-e: func() -> f64;
/// log10(2)/// @value 0.3010299956639812log10-n2: func() -> f64;
/// log10(e)/// @value 0.4342944819032518log10-e: func() -> f64;
/// Archimedes' constant (π)/// @value 3.141592653589793pi: func() -> f64;
/// sqrt(2)/// @value 1.4142135623730951sqrt-n2: func() -> f64;
/// The full circle constant (τ)/// @value 6.283185307179586tau: func() -> f64;
/// Odd numbers. Stream closes when it reaches max int./// @value [1]/// @expression |v| v + 2odd: asyncfunc() -> stream<u64>;
/// Even numbers. Stream closes when it reaches max int./// @value [0]/// @expression |v| v + 2even: asyncfunc() -> stream<u64>;
/// Arithmetic sequence. Stream closes when it reaches max int./// @expression || n + d * $iarithmetic: asyncfunc(n: u64, d: u64) -> stream<u64>;
/// Geometric sequence. Stream closes when it reaches max int./// @expression || n * r ** $igeometric: asyncfunc(n: u64, r: u64) -> stream<u64>;
/// Fibonacci sequence. Stream closes when it reaches max int./// @value [1, 1]/// @expression |a, b| a + bfibonacci: asyncfunc() -> stream<u64>;
/// Factorial sequence. Stream closes when it reaches max int./// @value [1, 1]/// @expression |v| v * $ifactorial: asyncfunc() -> stream<u64>;
/// Harmonic sequence. Stream closes when it reaches min-positive./// @expression || n / ($i + 1) as f64harmonic: asyncfunc(n: f64) -> stream<f64>;
/// Figurate sequence. Stream closes when it reaches max int./// @expression || $i ** nfigurate: asyncfunc(n: u64) -> stream<u64>;
/// Prime numbers, each found by trial division from the previous one./// Stream closes when it reaches max int./// @value [2]/// @expression |v| {/// let mut n = v + 1;/// let mut d: u64 = 2;/// while d * d <= n {/// if n % d == 0 {/// n += 1;/// d = 2;/// } else {/// d += 1;/// }/// }/// n/// }prime: asyncfunc() -> stream<u64>;
}
/// Pseudorandom number generators.interfacerandom {
/// Pseudorandom numbers from SplitMix64, each mixed from the seed and its/// position in the stream. The same seed always gives the same numbers./// Not cryptographically secure. The stream is unbounded.////// @expression || {/// let z = seed +% ($i +% 1) *% 0x9E3779B97F4A7C15;/// let z = (z ^ z >> 30) *% 0xBF58476D1CE4E5B9;/// let z = (z ^ z >> 27) *% 0x94D049BB133111EB;/// z ^ z >> 31/// }seeded-random: asyncfunc(seed: u64) -> stream<u64>;
/// Pseudorandom bytes, each 8 bytes one of `seeded-random`'s numbers for the/// same seed, little endian. Not cryptographically secure. The stream is/// unbounded.////// @expression || {/// let z = seed +% ($i / 8 +% 1) *% 0x9E3779B97F4A7C15;/// let z = (z ^ z >> 30) *% 0xBF58476D1CE4E5B9;/// let z = (z ^ z >> 27) *% 0x94D049BB133111EB;/// (z ^ z >> 31).to_le_bytes()/// }seeded-random-bytes: asyncfunc(seed: u64) -> stream<u8>;
}
/// Constants for the `u8` unsigned integer type.interface%u8 {
/// u8 max value/// @value 255max: func() -> u8;
/// u8 min value/// @value 0min: func() -> u8;
/// The size of `u8` in bits./// @value 8bits: func() -> u32;
}
/// Constants for the `u16` unsigned integer type.interface%u16 {
/// u16 max value/// @value 65535max: func() -> u16;
/// u16 min value/// @value 0min: func() -> u16;
/// The size of `u16` in bits./// @value 16bits: func() -> u32;
}
/// Constants for the `u32` unsigned integer type.interface%u32 {
/// u32 max value/// @value 4294967295max: func() -> u32;
/// u32 min value/// @value 0min: func() -> u32;
/// The size of `u32` in bits./// @value 32bits: func() -> u32;
}
/// Constants for the `u64` unsigned integer type.interface%u64 {
/// u64 max value/// @value 18446744073709551615max: func() -> u64;
/// u64 min value/// @value 0min: func() -> u64;
/// The size of `u64` in bits./// @value 64bits: func() -> u32;
}
/// Constants for the `s8` signed integer type.interface%s8 {
/// s8 max value/// @value 127max: func() -> s8;
/// s8 min value/// @value -128min: func() -> s8;
/// The size of `s8` in bits./// @value 8bits: func() -> u32;
}
/// Constants for the `s16` signed integer type.interface%s16 {
/// s16 max value/// @value 32767max: func() -> s16;
/// s16 min value/// @value -32768min: func() -> s16;
/// The size of `s16` in bits./// @value 16bits: func() -> u32;
}
/// Constants for the `s32` signed integer type.interface%s32 {
/// s32 max value/// @value 2147483647max: func() -> s32;
/// s32 min value/// @value -2147483648min: func() -> s32;
/// The size of `s32` in bits./// @value 32bits: func() -> u32;
}
/// Constants for the `s64` signed integer type.interface%s64 {
/// s64 max value/// @value 9223372036854775807max: func() -> s64;
/// s64 min value/// @value -9223372036854775808min: func() -> s64;
/// The size of `s64` in bits./// @value 64bits: func() -> u32;
}
/// Constants for the `f32` floating point type.interface%f32 {
/// The radix or base of the internal representation of `f32`./// @value 2radix: func() -> u32;
/// Number of significant digits in base 2./// @value 24mantissa-digits: func() -> u32;
/// Approximate number of significant digits in base 10./// @value 6digits: func() -> u32;
/// Machine epsilon value for `f32`, the difference between `1.0` and the next larger representable number./// @value 1.19209290e-07epsilon: func() -> f32;
/// Smallest finite `f32` value./// @value -3.40282347e+38min: func() -> f32;
/// Smallest positive normal `f32` value./// @value 1.17549435e-38min-positive: func() -> f32;
/// Largest finite `f32` value./// @value 3.40282347e+38max: func() -> f32;
/// One greater than the minimum possible normal power of 2 exponent./// @value -125min-exp: func() -> s32;
/// Maximum possible power of 2 exponent./// @value 128max-exp: func() -> s32;
/// Minimum *x* for which 10<sup>*x*</sup> is normal./// @value -37min-n10-exp: func() -> s32;
/// Maximum *x* for which 10<sup>*x*</sup> is normal./// @value 38max-n10-exp: func() -> s32;
/// Not a Number (NaN)./// @value nannan: func() -> f32;
/// Infinity (∞)./// @value infinfinity: func() -> f32;
/// Negative infinity (−∞)./// @value -infneg-infinity: func() -> f32;
}
/// Constants for the `f64` floating point type.interface%f64 {
/// The radix or base of the internal representation of `f64`./// @value 2radix: func() -> u32;
/// Number of significant digits in base 2./// @value 53mantissa-digits: func() -> u32;
/// Approximate number of significant digits in base 10./// @value 15digits: func() -> u32;
/// Machine epsilon value for `f64`, the difference between `1.0` and the next larger representable number./// @value 2.2204460492503131e-16epsilon: func() -> f64;
/// Smallest finite `f64` value./// @value -1.7976931348623157e+308min: func() -> f64;
/// Smallest positive normal `f64` value./// @value 2.2250738585072014e-308min-positive: func() -> f64;
/// Largest finite `f64` value./// @value 1.7976931348623157e+308max: func() -> f64;
/// One greater than the minimum possible normal power of 2 exponent./// @value -1021min-exp: func() -> s32;
/// Maximum possible power of 2 exponent./// @value 1024max-exp: func() -> s32;
/// Minimum *x* for which 10<sup>*x*</sup> is normal./// @value -307min-n10-exp: func() -> s32;
/// Maximum *x* for which 10<sup>*x*</sup> is normal./// @value 308max-n10-exp: func() -> s32;
/// Not a Number (NaN)./// @value nannan: func() -> f64;
/// Infinity (∞)./// @value infinfinity: func() -> f64;
/// Negative infinity (−∞)./// @value -infneg-infinity: func() -> f64;
}
worldconfig {
importconfig-values;
exportwasi:config/store@0.2.0-rc.1;
}
worldimports {
importconfig-values;
importcomponentized:component/types@0.1.0;
importcomponentized:component/wit@0.1.0;
importfactory;
import%u8;
import%u16;
import%u32;
import%u64;
import%s8;
import%s16;
import%s32;
import%s64;
import%f32;
import%f64;
}