【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