为什么Rust 更适合用于 serverless ? 因为它对用户来说更快,尤其是冷启动时. 点击下面的 Lambda冷启动分析
链接 来体验一下不同语言的冷启动速度.
<<Rust Web Programming>>
作者的访谈这是对 <<Rust Web Programming>>
作者 Maxwell Flitton 的访谈, 主要介绍如何使用 Rust 来构建 web 服务.
原文链接: https://rustacean-station.org/episode/maxwell-flitton/
本文详细介绍了如何使用 axum 来构建 web API.
原文链接: https://blog.frankel.ch/http-api-rust/
如库名所示, 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
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有