前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【Rust日报】2022-12-02 WasmEdge增加了Tokio 支持

【Rust日报】2022-12-02 WasmEdge增加了Tokio 支持

作者头像
MikeLoveRust
发布2023-02-10 16:04:03
3910
发布2023-02-10 16:04:03
举报

wasmer 推出 Wasmer Pack

这是一个与 WebAssembly Package Manager 和 WebAssembly Interfaces("WAI")整合的工具,可以创建可以从其他语言导入的包。

WebAssembly 软件包管理器的 WAI 附加功能,通过为你选择的语言自动生成可安装的软件包,简化了开发者在其应用程序中使用 WebAssembly 的方式。

详情请看:https://wasmer.io/posts/wasmer-takes-webassembly-libraries-manistream-with-wai

WasmEdge增加了Tokio 支持

WasmEdge 成功地移植了 tokio(一个 Rust 异步运行时)到 Wasm:https://github.com/WasmEdge/tokio。其秘诀是使用了自家基于 wasi-socket 开发的 non-blocking socket 和 poll 系统调用,替换掉了 tokio 自己的 non-blocking IO 实现。

代码实现:https://github.com/tokio-rs/mio/commit/c365b7c15b26bf1b4ee76b88b830fbb5054fd35b#diff-e56b51343750c5afbcc6759883c7834d510abb433f1f3fb404bedad21f24b5d7

Hyper 的 11 月报告

bevy_atmosphere 0.5 发布

详情请看:https://www.reddit.com/r/bevy/comments/za93oo/bevy_atmosphere_05_is_now_released/

Leptos 项目

Leptos 是一个全栈、同构的 Rust Web 框架,利用细粒度的反应性来构建声明式用户界面。

使用示例:

代码语言:javascript
复制
use leptos::*;

#[component]
pub fn SimpleCounter(cx: Scope, initial_value: i32) -> Element {
    // create a reactive signal with the initial value
    let (value, set_value) = create_signal(cx, initial_value);

    // create event handlers for our buttons
    // note that `value` and `set_value` are `Copy`, so it's super easy to move them into closures
    let clear = move |_| set_value(0);
    let decrement = move |_| set_value.update(|value| *value -= 1);
    let increment = move |_| set_value.update(|value| *value += 1);

    // this JSX is compiled to an HTML template string for performance
    view! {
        cx,
        <div>
            <button on:click=clear>"Clear"</button>
            <button on:click=decrement>"-1"</button>
            <span>"Value: " {move || value().to_string()} "!"</span>
            <button on:click=increment>"+1"</button>
        </div>
    }
}

// Easy to use with Trunk (trunkrs.dev) or with a simple wasm-bindgen setup
pub fn main() {
    mount_to_body(|cx| view! { cx,  <SimpleCounter initial_value=3 /> })
}

项目地址:https://github.com/gbj/leptos


From 日报小组 @Jancd

社区学习交流平台订阅:

  • Rust.cc论坛: 支持rss
  • 微信公众号:Rust语言学习交流
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2022-12-03,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Rust语言学习交流 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • wasmer 推出 Wasmer Pack
  • WasmEdge增加了Tokio 支持
  • Hyper 的 11 月报告
  • bevy_atmosphere 0.5 发布
  • Leptos 项目
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档