【Rust日报】2023-01-30 Rust 更适合 serverless

2023-05-16

Rust 更适合 serverless

为什么Rust 更适合用于 serverless ? 因为它对用户来说更快,尤其是冷启动时. 点击下面的 Lambda冷启动分析链接 来体验一下不同语言的冷启动速度.

b80f9b08b72934d2c3040135baed2b91.png

  • Lambda 冷启动分析: https://maxday.github.io/lambda-perf/

  • 源代码: https://github.com/maxday/lambda-perf

<<Rust Web Programming>> 作者的访谈

这是对 <<Rust Web Programming>> 作者 Maxwell Flitton 的访谈, 主要介绍如何使用 Rust 来构建 web 服务.

原文链接: https://rustacean-station.org/episode/maxwell-flitton/

边做边学: Rust构建 HTTP API 服务

本文详细介绍了如何使用 axum 来构建 web API.

原文链接: https://blog.frankel.ch/http-api-rust/

derive_more

如库名所示, derive_more 可以让你轻松的 derive 更多的 trait 实现, 而不用去写一堆的重复代码.

use derive_more::{Add, Display, From, Into};

#[derive(PartialEq, From, Add)]
struct MyInt(i32);

#[derive(PartialEq, From, Into)]
struct Point2D {
    x: i32,
    y: i32,
}

#[derive(PartialEq, From, Add, Display)]
enum MyEnum {
    #[display("int: {_0}")]
    Int(i32),
    Uint(u32),
    #[display("nothing")]
    Nothing,
}

assert!(MyInt(11) == MyInt(5) + 6.into());
assert!((5, 6) == Point2D { x: 5, y: 6 }.into());
assert!(MyEnum::Int(15) == (MyEnum::Int(8) + 7.into()).unwrap());
assert!(MyEnum::Int(15).to_string() == "int: 15");
assert!(MyEnum::Uint(42).to_string() == "42");
assert!(MyEnum::Nothing.to_string() == "nothing");

github地址:https://github.com/JelteF/derive_more

--

From 日报小组 BobQin,FBI小白 

社区学习交流平台订阅:

  • Rustcc论坛: 支持rss

  • 微信公众号:Rust语言中文社区

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

【Rust日报】2023-01-30 Rust 更适合 serverless 的相关文章

随机推荐