这是 amethyst 项目下的底层网络库,能够独立使用。提供了可靠传输与不可靠传输的选择。编程
发包微信
use laminar::{Socket, Packet};
// create the socketlet (mut socket, packet_sender, _) = Socket::bind("127.0.0.1:12345")?;
// our datalet bytes = vec![...];
// You can create packets with different reliabilitieslet unreliable = Packet::unreliable(destination, bytes);let reliable = Packet::reliable_unordered(destination, bytes);
// We can specify on which stream and how to order our packets, checkout our book and documentation for more informationlet unreliable = Packet::unreliable_sequenced(destination, bytes, Some(1));let reliable_sequenced = Packet::reliable_sequenced(destination, bytes, Some(2));let reliable_ordered = Packet::reliable_ordered(destination, bytes, Some(3));
// send the created packetspacket_sender.send(unreliable_sequenced).unwrap();packet_sender.send(reliable).unwrap();packet_sender.send(unreliable_sequenced).unwrap();packet_sender.send(reliable_sequenced).unwrap();packet_sender.send(reliable_ordered).unwrap();
收包
网络
use laminar::{SocketEvent, Socket};
// create the socketlet (mut socket, _, packet_receiver) = Socket::bind("127.0.0.1:12346")?;
// wait until a socket event occurslet result = packet_receiver.recv();
match result { Ok(socket_event) => { match socket_event { SocketEvent::Packet(packet) => { let endpoint: SocketAddr = packet.addr(); let received_data: &[u8] = packet.payload(); }, SocketEvent::Connect(connect_event) => { /* a client connected */ }, SocketEvent::Timeout(timeout_event) => { /* a client timed out */}, } } Err(e) => { println!("Something went wrong when receiving, error: {:?}", e); }}
Read More
Repo
闭包
cp 的替代品啊。什么都不说了,炫酷上图吧app
Repo机器学习
此库为 ndarray 的 ArrayBase
类型提供了统计方法。socket
到目前为止,Scipy.stats (Python)
和 StatsBase.jl (Julia)
中的大部分统计特性都已经移植过来了。用 Rust 作机器学习的同窗是否是能够上手了?ide
Repo工具
本库做者还邀请你们一块儿来讨论这个库的将来走向,好机会。学习
Roadmap
Rust官方及社区最新信息搜集、文章推送,教程学习,技巧分享,社区交流。信息来源是整个全球Rust社区。
之后本日报也会同步更新到此公众账号去。
读者frostRed和Yim前后总结出来的规则,你们能够参考讨论。
Github
在随书源码选择「精选」label也可看到。
这篇文章 详细说明了要达到这个目标须要注意的点,和相关的可以使用的辅助工具。