A General Embedded Chip Programming Software

Discussion: How to Use Mio Asynchronous Timer?

Official documentation

There are no example codes, making it difficult to understand how to use it

Someone provided an answer in the replies

extern crate mio;
extern crate mio_extras;

use mio::*;
use mio_extras::timer::{Timer, Builder};

use std::time::Duration;

fn main()
{
    const TIMER: Token = Token(2);

    let poll = Poll::new().unwrap();
    let mut gman: Timer = Default::default();

    poll.register(&gman, TIMER, Ready::readable(), PollOpt::edge()).unwrap();
    let mut gman_tout1;
    let mut events = Events::with_capacity(1024);
    gman_tout1 = gman.set_timeout(Duration::from_millis(2000), 9001);
    gman.cancel_timeout(&gman_tout1);

    loop {
        poll.poll(&mut events, None).unwrap();

        for event in &events {
            match event.token() {
                TIMER => {
                    println!("Timer-Event!");
                    if gman.poll() == Some(9001) {
                        println!("my timeout occurred");
                    }
                },
                _ => println!("awkward"),
            }
        }
    }
}

Read more

Faster Than Native: Running WebAssembly in the Linux Kernel

Running WASM in the kernel will achieve performance and flexibility,

The author believes it is a very promising application,

I personally think that WASM should add some IO functions to become a new cross-platform standard.

(The article mainly discusses wasmer, this WASM runtime)

Chinese introduction Read more

A General Embedded Chip Programming Software

Currently only supports Windows and ST-Link, with the long-term goal of replacing OpenOCD. The advantage over competitors is that it can program two chips simultaneously, so there is no need to plug and unplug the dongle for dual machine communication testing.

From @洛佳

Read more

Zero-Cost Abstraction

A new blog post from the official core team member, discussing “Zero-Cost Abstraction”.

Zero-Cost Abstraction is an important concept in C++ and Rust

In simple terms: it aims to have a small and lightweight runtime, which can also be optimized at compile time.

The author believes Rust has several great zero-cost abstractions

  1. Ownership, Borrowing

Guarantees correct memory usage

  1. Iterators, Closure Functions

Allows easy chaining of functions like map, filter, etc.

  1. Await Asynchronous Functions

Although the current await syntax is not yet finalized, achieving zero-cost abstraction using pinning is certain.

  1. Unsafe Functions, Module Boundaries

Due to the complexity of Rust’s syntax, many implementations will require low-level Unsafe implementations.

These Unsafe functions implement the underlying zero-cost abstraction,

allowing us to safely use these modules at a higher level.

Additionally, the member mentioned that trait objects are currently not zero-cost abstractions, and he wants to spend some time (at least 18 months) researching this issue, but there are always more urgent matters.

  • Reddit Discussion

  • Read More

wasm-bindgen v0.2.44 Starts Supporting Futures 0.3 and Async/Await

WASM can now use async, let’s see how to use it

  • Reddit Discussion

  • Read More

Terraform Generates 3D Terrain

Through Google Maps to obtain elevation maps, then convert them into 3D models

The video inside is from YouTube

Read more

From Daily Report Team @Damody Edited by @Chaos

Daily Report Subscription Address:

Independent Daily Report Subscription Address:

  • Telegram Channel

  • Alibaba Cloud Yuque Subscription

  • Steemit

  • GitHub

Community Learning Exchange Platform Subscription:

  • Rust.cc Forum: Supports RSS

  • Rust Force: Supports RSS

  • WeChat Official Account: Rust Language Learning Exchange

Leave a Comment