1
0
mirror of https://github.com/actix/examples synced 2025-06-28 18:00:37 +02:00

Add tiny_template as an example. (#358)

This commit is contained in:
Hanif Ariffin
2020-09-10 16:34:32 -04:00
committed by GitHub
parent ec6e14aacc
commit adccbe2a13
10 changed files with 183 additions and 10 deletions

View File

@ -43,14 +43,14 @@ async fn main() {
);
let (sink, stream) = UdpFramed::new(sock, BytesCodec::new()).split();
UdpActor::create(|ctx| {
ctx.add_stream(
stream.filter_map(
|item: Result<(BytesMut, SocketAddr)>| async {
item.map(|(data, sender)| UdpPacket(data, sender)).ok()
},
),
);
UdpActor { sink: SinkWrite::new(sink, ctx), }
ctx.add_stream(stream.filter_map(
|item: Result<(BytesMut, SocketAddr)>| async {
item.map(|(data, sender)| UdpPacket(data, sender)).ok()
},
));
UdpActor {
sink: SinkWrite::new(sink, ctx),
}
});
actix_rt::Arbiter::local_join().await;