Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Example Analysis of Rust Development in Fuchsia

Shulou Source: shulou.com Published: 2022-06-01 07:55:40 10月01日 Update

In this issue, the editor will bring you an example analysis of Rust development in Fuchsia. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

GameLisp

GameLisp is a scripting language for Rust game development. The Shredder project Shredder project focuses on the "garbage collection" of smart pointers to Rust. Derive_aktorderive_aktor is a macro library, which is easy to use. Project address: https://github.com/insanitybit/derive_aktor usage example:

Pub struct KeyValueStore

Where U: Hash + Eq + Send + 'static {

Inner_store: HashMap

Self_actor: Option

}

Impl) {

Println! ("query")

F (self.inner_store.get (& key) .map (String::from))

}

Pub fn set (& mut self, key: U, value: String) {

Println! ("set")

Self.inner_store.insert (key, value);}}

# [tokio::main] async fn main () {

Let (kv_store, handle) = KeyValueStoreActor::new (KeyValueStore::new ()) .await

/ / We can use an async API that's typed and nominal

Kv_store.query ("foo", Box::new (| value | println! ("before {:}", value)) .await

Kv_store.set ("foo", "bar". To _ owned ()) .await

Kv_store.query ("foo", Box::new (| value | println! ("after {:}", value)) .await

/ / We must drop any references to kv_store before we await the handle, or it will leak!

Drop (kv_store)

Handle.await

}

The above is the analysis of the example of Rust development in Fuchsia shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Tags: Analysis examples development projects content professional small and medium rich content address garbage that is pointers articles intelligence more knowledge articles scripts industry perspective Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Redmi MySQL Docker Microsoft