Forwarded from 坐和放宽版聊实验室 (坐和放宽 名前のない怪物)
班里只会学习的大佬学习:真·UFS2.1
其他同学学习:其他厂家·UFS2.1
我学习:华为·UFS2.1
其他同学学习:其他厂家·UFS2.1
我学习:华为·UFS2.1
duangsuse::Echo
拿lazy_statics替换了Rocket内建的State系统, naive_fortunes现在理论上速度更快了. #webdev #project
GET /fortune (siege https://127.0.0.1:81/fortune -t 30S -c 100 -v)
old
new
old
Transactions: 1911 hits
Availability: 100.00 %
Elapsed time: 29.75 secs
Data transferred: 0.21 MB
Response time: 1.02 secs
Transaction rate: 64.24 trans/sec
Throughput: 0.01 MB/sec
Concurrency: 65.80
Successful transactions: 1912
Failed transactions: 0
Longest transaction: 1.22
Shortest transaction: 0.05
new
Transactions: 2409 hits
Availability: 100.00 %
Elapsed time: 29.26 secs
Data transferred: 0.27 MB
Response time: 0.69 secs
Transaction rate: 82.33 trans/sec
Throughput: 0.01 MB/sec
Concurrency: 56.53
Successful transactions: 2409
Failed transactions: 0
Longest transaction: 1.13
Shortest transaction: 0.06
Forwarded from RustPlayBot
This is RustPlayBot 0.0.9 ,Rust versions:
Stable:rustc 1.21.0 (3b72af97e 2017-10-09),
Beta:rustc 1.22.0-beta.1 (e694dd37b 2017-10-12),
Nightly:rustc 1.22.0-nightly (4750c1ec0 2017-10-19)
Stable:rustc 1.21.0 (3b72af97e 2017-10-09),
Beta:rustc 1.22.0-beta.1 (e694dd37b 2017-10-12),
Nightly:rustc 1.22.0-nightly (4750c1ec0 2017-10-19)
#webdev #backend #Rust #wtf duangsuse 被自己坑了好久才搞出一个代ACAO头的响应器... 原因竟然是Rust没自动为StrCORS实现AsRef<[u8]>, AsRef<[u8]>也没有Derive宏, duangsuse自己复制粘贴std的代码时忘记要把self.as_bytes() 改成self.0.as_bytes()了... 🙈
struct StrCORS (String);
impl<'r> Responder<'r> for StrCORS {
fn respond_to(self, _: &Request) -> Result<Response<'r>, Status> {
Response::build()
.raw_header("Content-Type", "text/plain; charset=utf-8")
.raw_header("Access-Control-Allow-Origin", "*")
.sized_body(Cursor::new(self.0))
.ok()
}
}
impl AsRef<[u8]> for StrCORS {
#[inline]
fn as_ref(&self) -> &[u8] {
self.0.as_bytes()
}
}
impl StrCORS{
fn new_with_string(string: String) -> StrCORS { StrCORS(string) }
}