This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(futures_api, async_await, await_macro, arbitrary_self_types)] | |
#[macro_use] | |
extern crate lazy_static; | |
use std::future::{Future}; | |
use std::task::{Poll}; | |
use std::pin::Pin; | |
use std::{thread, time}; | |
use std::sync::mpsc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[osaka] | |
fn foo(poll: Poll, a: Stream, b: Stream) { | |
loop { | |
let again = match a.read() { | |
Ready => do something, | |
Again => a, | |
}; | |
match b.read() { | |
Ready => do something | |
Again => yield a.merge(b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[osaka] | |
fn foo(poll: Poll, a: Stream, b: Stream) { | |
loop { | |
let again = match a.read() { | |
Ready => do something, | |
Again => a, | |
}; | |
match b.read() { | |
Ready => do something | |
Again => yield a.merge(b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loop { | |
match info_req.try_recv() { | |
Err(std::sync::mpsc::TryRecvError::Empty) => (), | |
Err(std::sync::mpsc::TryRecvError::Disconnected) => break, | |
Ok(v) => { | |
info!("got req for {}", v.0); | |
ep.connect(v.0.clone())?; | |
open_connects.insert(v.0, (v.1, )); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
secret = "your secret" | |
[publish] | |
shadow = "your shadow public key" | |
[[authorize]] | |
identity = "your own public key" | |
resource = "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aep@stark: ~/proj/devguard/carrier2 RUST_LOG=carrier cargo run | |
Compiling carrier-core v0.8.0 (/home/aep/proj/devguard/carrier2) | |
error[E0277]: the size for values of type `(dyn endpoint::Driver + 'static)` cannot be known at compilation time | |
--> src/main.rs:96:18 | |
| | |
96 | let mut ep = osaka::sync!(ep).run(); | |
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | |
| | |
= help: within `endpoint::Endpoint<PublisherDriver>`, the trait `std::marker::Sized` is not implemented for `(dyn endpoint::Driver + 'static)` | |
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use dns::DnsRecord; | |
use error::Error; | |
use clock; | |
use osaka::mio::net::UdpSocket; | |
use osaka::osaka; | |
use noise; | |
use proto; | |
use identity; | |
use keystore; | |
use std::time::{Duration}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
181 | let sock = UdpSocket::bind(&"0.0.0.0:0".parse().unwrap()).map_err(|e| Error::Io(e))?; | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | |
| | |
= help: within `endpoint::Endpoint<_>`, the trait `std::marker::Sized` is not implemented for `(dyn endpoint::Driver + 'static)` | |
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> | |
= note: required because it appears within the type `endpoint::Endpoint<_>` | |
= note: required because of the requirements on the impl of `std::ops::Try` for `std::result::Result<endpoint::Endpoint<_>, error::Error>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// this is describes how to build typed combinators to a friend | |
/// he wanted to build a generic job executor thing that can execute one step at a time and forward | |
/// the intermediate data to the next step without copying | |
/// but all type safe of course. | |
/// | |
/// my approach is sort of a practical take on category theory that rust does with for example futures | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use carrier::*; | |
use futures::{Future, Sink, Stream}; | |
use failure::Error; | |
use diesel::{self, RunQueryDsl}; | |
use std::env; | |
use std::time::{SystemTime}; | |
use std::sync::Mutex; | |
use futures::sync::mpsc; | |
use std::mem; | |
use std::thread; |