【Rust日报】 2019-11-17
- 2019 年 11 月 27 日
- 筆記
ambassador 程序宏實作的委派 trait (Delegation of trait implementations via procedural macros)
目前只支援 1.40
比如你有貓跟狗都會叫,然後你有個動物enum在上層
想要模仿繼承的感覺,那就是他
use ambassador::{delegatable_trait, Delegate}; #[delegatable_trait] pub trait Shout { fn shout(&self, input: &str) -> String; } pub struct Cat; impl Shout for Cat { fn shout(&self, input: &str) -> String { format!("{} - meow!", input) } } pub struct Dog; impl Shout for Dog { fn shout(&self, input: &str) -> String { format!("{} - wuff!", input) } } #[derive(Delegate)] #[delegate(Shout)] pub enum Animal { Cat(Cat), Dog(Dog), } pub fn main() { let foo_animal = Animal::Cat(Cat); println!("{}", foo_animal.shout("BAR")); }
Read more
repotools rust縮寫指令小工具
將 git diff, git add -A, git status, git diff --cached, git commit -m <message>, git push and git shortlog -se
用 dp, aa, st, di, cm, pu and le
取代
Read more
rayn 0.3
SIMD 加速
分形渲染
Read more
MIDI 實體播放器使用 AD9833與 BluePill版子
有人使用了rust結合硬體做了 MIDI 播放器
對嵌入式有興趣的朋友不要錯過了
Read more
From 日报小组 @Damody
日报订阅地址:
独立日报订阅地址:
- Telgram Channel
- 阿里云语雀订阅
- Steemit
- GitHub
社区学习交流平台订阅:
- Rust.cc论坛: 支持rss
- Rust Force: 支持rss