< 返回版块

gensmusic 发表于 2023-08-21 17:53

tower 库简介

tower 是一个为构建 健壮的网络客户端和服务器提供模块化和可重用组件的库。它提供了一个简单的核心抽象,即 Service trait,它表示一个异步函数,接受一个请求并返回一个响应或错误.

img

原文链接

serde 去除预编译的二进制

在最近的版本中,serde 开始将 serde_derive 作为预编译二进制文件进行分发。 这引起了一些开发人员的反对,他们担心这会带来安全风险。一些开发人员还要求将预编译二进制文件作为可选项,而不是默认提供.

最终, serde 在 v1.0.184 版本中去掉了预编译的二进制文件.

serde v1.0.184 release

Rust devs push back as Serde project ships precompiled binaries

zfi: 零成本且安全的 UEFI 固件接口

zfi 是一个 用于编写 UEFI 应用程序的 Rust crate,具有以下目标:

  • 提供几乎与 UEFI 规范完全相同的基础 API。
  • 提供在基础 API 之上构建的附加 API。
  • 基础 API 是 UEFI API 的零成本抽象。
  • 安全且易于使用。
  • 可以在 stable Rust 上工作。

ZFI 仅支持单线程环境,这与 UEFI 规范相同。

#![no_std]
#![no_main]

use alloc::boxed::Box;
use zfi::{pause, println, DebugFile, Image, Status, SystemTable};

extern crate alloc;

#[no_mangle]
extern "efiapi" fn efi_main(image: &'static Image, st: &'static SystemTable) -> Status {
    // This is the only place you need to use unsafe. This must be done immediately after landing
    // here.
    unsafe {
        zfi::init(
            image,
            st,
            Some(|| Box::new(DebugFile::next_to_image("log").unwrap())),
        )
    };

    // Any EFI_HANDLE will be represents by a reference to a Rust type (e.g. image here is a type of
    // Image). Each type that represents EFI_HANDLE provides the methods to access any protocols it
    // is capable for (e.g. you can do image.proto() here to get an EFI_LOADED_IMAGE_PROTOCOL from
    // it). You can download the UEFI specifications for free here: https://uefi.org/specifications
    println!("Hello, world!");
    pause();

    Status::SUCCESS
}

#[cfg(not(test))]
#[panic_handler]
fn panic_handler(info: &core::panic::PanicInfo) -> ! {
    zfi::eprintln!("{info}");
    loop {}
}

#[cfg(not(test))]
#[global_allocator]
static ALLOCATOR: zfi::PoolAllocator = zfi:PoolAllocator;

github地址

使用 Axum 构建内存实现的 Todo 应用

这是一个油管视频,介绍了如何使用 axum 框架来构建一个内存实现的 Todo 应用, 他包含以下内容:

  • Rust 模块系统,它将帮助我们构建 Axum Rust 文件夹的结构。
  • 为什么使用 Rust Mutex。
  • 为什么使用 Rust RwLock。
  • Rust 标准 Mutex/RwLock 和 Tokio Mutex/RwLock 的区别
  • axum 如何配置路由

油管视频

--

From 日报小组 FBI小白

社区学习交流平台订阅:

评论区

写评论

还没有评论

1 共 0 条评论, 1 页