Sway编程语言-更新中(The Sway Programming Language-Updatin
  • Sway编程语言(The Sway Programming Language)
  • 1. 导言(Introduction)
    • 1.1 安装(Installation)
    • 1.2 Sway快速入门 (Sway Quickstart)
    • 1.3 Fuel工具链 (The Fuel Toolchain)
    • 1.4 一个Forc项目 (A Forc Project)
    • 1.5 标准库 (Standard Library)
  • 2. 示例(Example)
    • 2.1计数器(Counter)
    • 2.2子货币(Subcurrency)
    • 2.3 FizzBuzz
    • 2.4 钱包智能合约(Wallet Smart Contract)
  • 3.Sway编程类型(Sway Program Types)
    • 3.1 合约(Contracts)
    • 3.2 库 (Libraries)
    • 3.3 脚本(Scripts)
    • 3.4 谓词 (Predicates)
  • 4. Sway语言基础 (Sway Language basics)
    • 4.1 变量 (Variables)
    • 4.2 内置类型(Built-in Types)
    • 4.3 常用库类型(Commonly Used Library Types)
    • 4.4 区块链类 (Blockchain Types)
    • 4.5 函数 (Functions)
    • 4.6 结构、元祖和穷举 (Structs, Tuples, and Enums)
    • 4.7 方法和关联函数 (Methods and Associated Functions)
    • 4.8 注释和日志 (Comments and Logging)
    • 4.9 控制流 (Control Flow)
  • 5. 用Sway部署区块链 (Blockchain Development with Sway)
    • 5.1 哈希和加密学 (Hashing and Cryptography)
    • 5.2 合约存储(Contract Storage)
    • 5.3 函数纯度 (Function Purity)
    • 5.4 标识符(Identifiers)
    • 5.5 原生资产(Native Assets)
    • 5.6 访问控制 (Access Control)
    • 5.7 调用合约(Calling Contracts)
  • 6. 高级概念 (Advanced Concepts)
    • 6.1 高级类型 (Advanced Types)
    • 6.2 通用类型 (Generic Types)
    • 6.3 特征 (Traits)
    • 6.4 集 (Assembly)
  • 7. 一般集聚 (Common Collections)
    • 7.1 堆上的向量(Vectors on the Heap)
    • 7.2 存储向量 (Storage Vectors)
    • 7.3 存储映射 (Storage Maps)
  • 8.测试(Testing)
    • 8.1 单元测试(Unit Testing)
    • 8.2 用Rust来测试 (Testing with Rust)
  • 9.应用前端开发 (Application Frontend Development)
    • 9.1 TypeScript SDK
  • 10.Sway应用(Sway Reference)
    • 10.1 编译器内部函数(Compiler Intrinsics)
    • 10.2 属性(Attributes)
    • 10.3 风格向导(Style Guide)
    • 10.4 已知各类问题(Known Issues and Workarounds)
    • 10.5 与Solidity的不同之处 (Differences From Solidity)
    • 10.6 与Rust的不同之处 (Differences From Rust)
    • 10.7 向Sway贡献 (Contributing To Sway)
  • 11. Forc引用 (Forc Reference)
    • 11.1清单参考 (Manifest Reference)
    • 11.2 工作区(Workspaces)
    • 11.3 依赖(Dependencies)
    • 11.4 命令(Commands)
      • 11.4.1 forc-addr2line
      • 11.4.2 forc-build
      • 11.4.3 forc-check
Powered by GitBook
On this page
  • Forc (forc)
  • Sway语言服务(forc-lsp)-Sway Language Server (forc-lsp)
  • Sway 格式化程序(forc-fmt) - Sway Formatter (forc-fmt)
  • Fuel核心-Fuel Core (fuel-core)
  1. 1. 导言(Introduction)

1.3 Fuel工具链 (The Fuel Toolchain)

Previous1.2 Sway快速入门 (Sway Quickstart)Next1.4 一个Forc项目 (A Forc Project)

Last updated 2 years ago

The Fuel toolchain consists of several components.

Fuel 工具链由几个组件组成。

Forc (forc)

The "Fuel Orchestrator" is our equivalent of Rust's . It is the primary entry point for creating, building, testing, and deploying Sway projects.

“Fuel Orchestrator” 相当于 Rust 的.它是创建、构建、测试和部署 Sway 项目的主要入口点。

Sway语言服务(forc-lsp)-Sway Language Server (forc-lsp)

The Sway Language Server forc-lsp is provided to expose features to IDEs. .

提供 Sway 语言服务器forc-lsp 以向 IDE 公开功能。您可查看 。

Currently, only . Vim support is forthcoming, though .

目前,仅。 Vim 支持即将推出,不过目前也 。

Note: There is no need to manually run forc-lsp (the plugin will automatically start it), however both forc and forc-lsp must be in your $PATH. To check if forc is in your $PATH, type forc --help in your terminal.

注意:无需手动运行forc-lsp(插件会自动启动),但是forc 和forc-lsp 都必须在您的$PATH 中。要检查 forc 是否在您的 $PATH 中,请在终端中键入 forc --help。

Sway 格式化程序(forc-fmt) - Sway Formatter (forc-fmt)

A canonical formatter is provided with forc-fmt. . It can be run manually with

forc-fmt 提供了规范的格式化程序。您可查看 。它可以用以下命令手动运行

forc fmt
"[sway]": {
  "editor.defaultFormatter": "FuelLabs.sway-vscode-plugin"
}

Fuel核心-Fuel Core (fuel-core)

The will automatically format Sway files with forc-fmt on save, though you might have to explicitly set the Sway plugin as the default formatter, like this:

将在保存时,自动使用 forc-fmt 格式化 Sway 文件,尽管您可能必须明确用以下方式将 Sway 插件设置为默认的格式化程序:

An implementation of the Fuel protocol, , is provided together with the Sway toolchain to form the Fuel toolchain. will automatically start and stop an instance of the node during tests, so there is no need to manually run a node unless using Forc directly without the SDK.

Fuel 协议的实现 与 Sway 工具链 一起提,进而形成 Fuel 工具链。 会在测试期间自动启动和停止节点实例,因此无需手动运行节点,除非在没有 SDK 的情况下直接使用 Forc .

Forc
Cargo
Forc
Cargo
Installation instructions
安装说明
Visual Studio Code is supported through a plugin
syntax highlighting is provided
通过插件支持 Visual Studio Code
提供了语法高亮显示
Installation instructions
安装说明
Visual Studio Code plugin
Visual Studio Code 插件
Fuel Core
The Rust SDK
Fuel Core
Rust SDK