小编Leo*_*Ven的帖子

是否可以在另一个板条箱中定义#[wasm_bindgen]公共结构和函数?

我有一个lib包含大量结构和实现的板条箱。然后我还有另一个叫做web它将核心移植lib到网络上的工具。还有一种api情况是我希望应用程序位于服务器端。

  • myproject-api
  • myproject-lib
  • myproject-web

我不想要的是将所有wasm依赖项添加到lib, 仅在web项目中并将主库的部分内容公开到网络。in#[wasm_bindgen]中定义的结构是否可能?myproject-libmyproject-web

rust wasm-bindgen

10
推荐指数
1
解决办法
1689
查看次数

在为 WSL 安装 Rust 时,线程“main”因“断言失败:`(left == right)` 左:“22”,右:“4”而恐慌

我访问该网站并看到一个下载 Rust 安装程序的脚本:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Run Code Online (Sandbox Code Playgroud)

我更改了选项中的一些内容Customize Installation并继续安装,然后出现以下错误:

info: profile set to 'complete'
info: setting default host triple to x86_64-unknown-linux-gnu
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2020-05-04, rust version 1.45.0-nightly (65b448273 2020-05-03)
warning: Force-skipping unavailable component 'lldb-preview-x86_64-unknown-linux-gnu'
warning: Force-skipping unavailable component 'rls-x86_64-unknown-linux-gnu'
info: downloading component 'cargo'
  5.0 MiB /   5.0 MiB (100 %)   3.2 MiB/s in  2s ETA:  0s
info: downloading component 'clippy'
info: downloading component 'llvm-tools-preview'
info: downloading …
Run Code Online (Sandbox Code Playgroud)

installation rust windows-subsystem-for-linux

5
推荐指数
1
解决办法
7424
查看次数

如何更改现有 TextStyle 的特定属性?

我想制作一个自定义小部件,它基本上通过获取一个文本,将它包装在一个包含两个文本的堆栈中,其中一个用一个笔触呈现来为文本添加一个笔触。

class BorderedText extends StatelessWidget {
  final Text displayText;
  final Color strokeColor;
  final double strokeWidth;

  BorderedText(this.displayText,
      {Key key, this.strokeColor = Colors.black, this.strokeWidth = 1.0})
      : assert(displayText != null),
        super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Stack(
        children: <Widget>[
          Text(
            displayText.data,
            style: displayText.style
              ..foreground = Paint()
                ..style = PaintingStyle.stroke
                ..strokeWidth = strokeWidth
                ..color = strokeColor,
          ),
          displayText,
        ],
      ),
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

预期使用方式:

BorderedText(
  Text(
    "Hello App",
    style: TextStyle(
      color: Colors.white,
      fontSize: 34.0,
      fontFamily: "LexendMega",
    ),
  ),
  strokeWidth: …
Run Code Online (Sandbox Code Playgroud)

dart flutter

3
推荐指数
1
解决办法
177
查看次数