前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【Rust日报】2023-09-02 Freya GUI 库

【Rust日报】2023-09-02 Freya GUI 库

作者头像
MikeLoveRust
发布2023-09-26 19:32:28
3320
发布2023-09-26 19:32:28
举报

Freya GUI 库

我发布了 Freya 的第一个版本,这是一个由 Dioxus 和 Skia 提供支持的 Rust 实验性原生 GUI 库。目前它可以在 Windows、macOS 和 Linux 上运行。

我希望第一个版本能够收集建议、想法、反馈和贡献。

文章链接,https://www.reddit.com/r/rust/comments/167zdd8/announcing_freya_gui_library/

Github 链接,https://github.com/marc2332/freya

Granian HTTP server

用于 Python 应用程序的 Rust HTTP 服务器。

Granian背后的主要原因是:

  • 拥有单一、正确的 HTTP 实现,支持版本 1、2(最终是 3)
  • 为多个平台提供单一包
  • 避免 unix 系统上常见的 Gunicorn + uvicorn + http-tools 依赖组合
  • 与现有替代方案相比,提供稳定的性能

文章链接,https://www.reddit.com/r/rust/comments/167yf41/granian_http_server_open_call_for_core/

Github 链接,https://github.com/emmett-framework/granian

Pavex DevLog #6: 设计安全且符合人体工程学的中间件

现在是 Pavex 的另一份进度报告的时候了,其中涵盖了 7 月和 8 月所做的工作!

我一直在努力实现一个目标:为 Pavex 添加中间件支持。目前还远未完善,但它(终于)可以工作了

我将利用这份报告作为深入探讨以下几个主题的机会:

  • 为什么中间件支持是生产就绪的关键要求
  • 为 Rust Web 框架设计中间件系统的挑战
  • Pavex的中间件设计
  • 我们当前实施的局限性

但如果您时间有限,这里有一个简单的超时中间件来展示 Pavex 中的中间件:

代码语言:javascript
复制
use pavex::{middleware::Next, response::Response};
use std::future::IntoFuture;
use tokio::time::{timeout, error::Elapsed};

pub async fn timeout_middleware<C>(
    // A handle on the rest of the processing pipeline for the incoming
    // request. 
    //
    // Middlewares can choose to short-circuit the execution (i.e. 
    // return an error and abort the processing) or perform some 
    // computation and then delegate to `next` by awaiting it.
    //
    // All middlewares in Pavex *must* take `Next<_>` as an input.
    next: Next<C>,
    // Middlewares can take advantage of dependency injection! 
    // You just list what inputs you need and the framework will provide them
    // (if possible, or return a nice error at *compile-time* if not).
    //
    // `TimeoutConfig` could be defined at start-up time, sharing the same 
    // value for all routes, or it could be customised at runtime on a 
    // per-request basis (e.g. to provide a configurable quality of service
    // depending on the pricing plan of the client issueing the request).
    // `timeout_middleware` doesn't care how or when `TimeoutConfig`
    // gets computed. 
    // Happy decoupling!
    config: TimeoutConfig
) -> Result<Response, Elapsed>
where
    C: IntoFuture<Output = Response>
{
    timeout(config.request_timeout, next.into_future()).await
}

文章链接,https://www.lpalmieri.com/posts/pavex-progress-report-06/

本文参与?腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2023-09-03 23:54,如有侵权请联系?cloudcommunity@tencent.com 删除

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

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

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

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Freya GUI 库
  • Granian HTTP server
  • Pavex DevLog #6: 设计安全且符合人体工程学的中间件
相关产品与服务
消息队列 TDMQ
消息队列 TDMQ (Tencent Distributed Message Queue)是腾讯基于 Apache Pulsar 自研的一个云原生消息中间件系列,其中包含兼容Pulsar、RabbitMQ、RocketMQ 等协议的消息队列子产品,得益于其底层计算与存储分离的架构,TDMQ 具备良好的弹性伸缩以及故障恢复能力。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
http://www.vxiaotou.com