摘要: Rust:axum学习笔记(2) response 上一篇的hello world里,示例过于简单,仅仅只是返回了一个字符串,实际上axum的response能返回各种格式,包括: plain_texthtmljsonhttp StatusCode...web开发中需要的各种格式,都能返回。talk is cheap ,show me the cod 阅读全文
posted @ 2021-12-26 22:52 菩提树下的杨过 阅读(2797) 评论(2) 推荐(0) 编辑
摘要: Rust:axum学习笔记(1) hello world axum是Rust生态的web框架新秀,虽然项目成立不久,但github上的star数已超2.8k,其底层依赖的是高性能的Tokio,Tokio这货就不多说了,借用知乎《深入浅出Rust异步编程之Tokio》上的一张图: Rust中的Tokio几乎是同类框架的性能天花板了,而axum在Tokio基础 阅读全文
posted @ 2021-12-26 21:05 菩提树下的杨过 阅读(4642) 评论(0) 推荐(0) 编辑
摘要: Rust: Tcp编程Demo 最基本的Hello World示例: TcpServer端: use std::{net::TcpListener, io::{Read, Write}}; fn main() { //绑定本机3000端口 let listener = TcpListener::bind("127.0.0.1:30 阅读全文
posted @ 2021-12-26 20:14 菩提树下的杨过 阅读(778) 评论(0) 推荐(0) 编辑