Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

各目标可用的模块

English

标准模块用 import std.<name> 导入。模块须由当前构建目标提供。

模块用途browserwasiplugin
std.jsonJSON 值、解析与序列化是是是
std.log分级日志是是是
std.math数学常量和函数是是是
std.bytes字节序转换和有边界检查的二进制读取是是是
std.collections双端队列、优先队列、分组和计数是是是
std.csv按 CSV 引号规则处理分隔文本是是是
std.date公历日期、UTC 时间戳和 Unix 时间转换是是是
std.encoding十六进制、Base64、Base64url 和百分号编码是是是
std.fmt值格式化和整数进制转换是是是
std.iter惰性迭代器来源是是是
std.path以斜杠分隔的路径文本操作是是是
std.stats统计摘要、方差、标准差和中位数是是是
std.text按 Unicode 标量截断和填充,移除前后缀是是是
std.time时钟和休眠是是依赖宿主
std.random随机数是是依赖宿主
std.httpHTTP 客户端是是依赖宿主
std.worker并行工作线程是依赖宿主依赖宿主
std.io标准输入与输出—是—
std.fs文件和目录—是—
std.env参数、环境变量和退出—是—
std.dom浏览器文档是——

“依赖宿主”表示目标 world 须包含相应接口。在 wasi 上,std.worker 使用内嵌运行时提供的 puddi:runtime 接口。插件的 std.log 在 world 包含日志接口时写入宿主,否则不输出。

详见便携模块 API 参考和标准库源码。