【Rust日报】 2019-10-25 例子學習:基於Autoref的穩定特化
- 2019 年 10 月 31 日
- 筆記
Scriptisto 一個語言無關的輔助程式
可以直接幫你編譯c程式然後直接執行
這樣就可以把c當腳本一樣執行了
Read more
Rust devroom:一個研討會在 2020/02/02 星期日 布魯塞爾,比利時
本專題集合了Rust生態中令人興奮(據專題作者描述)的工具和動態。
Read more
歡迎pnkfelix作為編譯器團隊的共同負責人!
Read more
Rust+GNOME hackfest
這些hackfest的目標是改善Rust與GNOME庫之間的交互。
會出現在新版的 gtk-rs
Read more
例子學習:基於Autoref的穩定特化
我的理解是像C++裡的泛型偏特化
以下面的例子為例
可以特化為任何實作Display trait的類型
或是直接針對 String 做特化行為
#![feature(specialization)] use std::fmt::{Display, Write}; pub trait MyToString { fn my_to_string(&self) -> String; } // General impl that applies to any T with a Display impl. impl<T: Display> MyToString for T { default fn my_to_string(&self) -> String { let mut buf = String::new(); buf.write_fmt(format_args!("{}", self)).unwrap(); buf.shrink_to_fit(); buf } } // Specialized impl to bypass the relatively expensive std::fmt machinery. impl MyToString for String { fn my_to_string(&self) -> String { self.clone() } }
Read more
docs.rs 出問題後的事後處理
問題原因
docs.rs需要先將構建的文檔存儲在文件系統上,
然後再將其上傳到數據庫,並且要在/opt/docs-rs-prefix/documentations目錄中進行。
docs.rs從來沒有清除過該目錄,因此隨著時間的流逝,它愈來愈大,直到無法執行。
雖然我們有寫定期清除臨時目錄的代碼,但是從未設定過清除引起中斷的目錄的代碼。
解法
由於該目錄不包含任何需要保留的資料,因此我們直接清除,然後重新啟動了服務器。
事後處理
要有通知硬碟使用到90%了,每次建構失敗也要有通知。
Read more
FastSpark Apache Spark 的新實現
簡單來說問題出在記憶體配置演算法的差距
結果就是時間的只要三分之一
Time taken for FastSpark: 19mins and 35secs Time taken for Apache Spark: 1hour and 2mins
Read more