赞
踩
这是 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 MoreRepo
cp 的替代品啊。什么都不说了,炫酷上图吧
Repo
此库为 ndarray 的 ArrayBase
类型提供了统计方法。
到目前为止,Scipy.stats (Python)
和 StatsBase.jl (Julia)
中的大部分统计特性都已经移植过来了。用 Rust 做机器学习的同学是不是可以上手了?
Repo
本库作者还邀请大家一起来讨论这个库的未来走向,好机会。
Roadmap
Rust官方及社区最新信息搜集、文章推送,教程学习,技巧分享,社区交流。信息来源是整个全球Rust社区。
以后本日报也会同步更新到此公众帐号去。
读者frostRed和Yim先后总结出来的规则,大家可以参考讨论。
Github
在随书源码选择「精选」label也可看到。
这篇文章 详细说明了要达到这个目标需要注意的点,和相关的可使用的辅助工具。
推荐学习。
NEAT算法玩Flappy Bird(像素鸟) ,群友贡献,棒棒哒!JiaYe(planet0104)
动画图太大,查看原文看吧。
https://raw.githubusercontent.com/planet0104/neat-flappy-bird/master/images/video.gif
Repo
From 日报小组 @Mike
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。