前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【Rust日报】2023-01-30 Rust 更适合 serverless

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

作者头像
MikeLoveRust
发布2023-02-15 20:44:01
5010
发布2023-02-15 20:44:01
举报

Rust 更适合 serverless

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

  • 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 实现, 而不用去写一堆的重复代码.

代码语言:javascript
复制
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

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2023-01-30,如有侵权请联系 cloudcommunity@tencent.com 删除

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

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

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

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Rust 更适合 serverless
  • 对<<Rust Web Programming>> 作者的访谈
  • 边做边学: Rust构建 HTTP API 服务
  • derive_more
相关产品与服务
API 网关
腾讯云 API 网关(API Gateway)是腾讯云推出的一种 API 托管服务,能提供 API 的完整生命周期管理,包括创建、维护、发布、运行、下线等。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档