Change calls of proto!
to use parens.
This commit is contained in:
parent
c74a442e86
commit
77e83d83a9
@ -134,11 +134,11 @@ fn with<A,B>(future: &Future<A>, blk: fn((&A)) -> B) -> B {
|
||||
blk(v)
|
||||
}
|
||||
|
||||
proto! future_pipe {
|
||||
proto! future_pipe (
|
||||
waiting:recv<T:send> {
|
||||
completed(T) -> !
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
#[test]
|
||||
fn test_from_value() {
|
||||
|
@ -7,14 +7,14 @@ directions they can flow at any given point are determined by a
|
||||
protocol. Below is an example protocol.
|
||||
|
||||
~~~
|
||||
proto! pingpong {
|
||||
proto! pingpong (
|
||||
ping: send {
|
||||
ping -> pong
|
||||
}
|
||||
pong: recv {
|
||||
pong -> ping
|
||||
}
|
||||
}
|
||||
)
|
||||
~~~
|
||||
|
||||
The `proto!` syntax extension will convert this into a module called
|
||||
@ -893,11 +893,11 @@ fn spawn_service_recv<T: send, Tb: send>(
|
||||
|
||||
// Streams - Make pipes a little easier in general.
|
||||
|
||||
proto! streamp {
|
||||
proto! streamp (
|
||||
open:send<T: send> {
|
||||
data(T) -> open<T>
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
/// A trait for things that can send multiple messages.
|
||||
trait channel<T: send> {
|
||||
@ -1138,11 +1138,11 @@ impl<T: send, U: send, Left: selectable recv<T>, Right: selectable recv<U>>
|
||||
}
|
||||
}
|
||||
|
||||
proto! oneshot {
|
||||
proto! oneshot (
|
||||
oneshot:send<T:send> {
|
||||
send(T) -> !
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
/// The send end of a oneshot pipe.
|
||||
type chan_one<T: send> = oneshot::client::oneshot<T>;
|
||||
|
@ -3,14 +3,14 @@
|
||||
This is frequently called the pipe compiler. It handles code such as...
|
||||
|
||||
~~~
|
||||
proto! pingpong {
|
||||
proto! pingpong (
|
||||
ping: send {
|
||||
ping -> pong
|
||||
}
|
||||
pong: recv {
|
||||
pong -> ping
|
||||
}
|
||||
}
|
||||
)
|
||||
~~~
|
||||
|
||||
There are several components:
|
||||
|
@ -15,11 +15,11 @@ import std::time;
|
||||
|
||||
import pipes::recv;
|
||||
|
||||
proto! ring {
|
||||
proto! ring (
|
||||
num:send {
|
||||
num(uint) -> num
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
fn macros() {
|
||||
#macro[
|
||||
|
@ -7,7 +7,7 @@ use std;
|
||||
import pipes::{spawn_service, recv};
|
||||
import std::time::precise_time_s;
|
||||
|
||||
proto! pingpong {
|
||||
proto! pingpong (
|
||||
ping: send {
|
||||
ping -> pong
|
||||
}
|
||||
@ -15,9 +15,9 @@ proto! pingpong {
|
||||
pong: recv {
|
||||
pong -> ping
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
proto! pingpong_unbounded {
|
||||
proto! pingpong_unbounded (
|
||||
ping: send {
|
||||
ping -> pong
|
||||
}
|
||||
@ -29,7 +29,7 @@ proto! pingpong_unbounded {
|
||||
you_will_never_catch_me: send {
|
||||
never_ever_ever -> you_will_never_catch_me
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// This stuff should go in libcore::pipes
|
||||
macro_rules! move_it (
|
||||
|
@ -142,7 +142,7 @@ mod map_reduce {
|
||||
}
|
||||
|
||||
|
||||
proto! ctrl_proto {
|
||||
proto! ctrl_proto (
|
||||
open: send<K: copy send, V: copy send> {
|
||||
find_reducer(K) -> reducer_response<K, V>,
|
||||
mapper_done -> !
|
||||
@ -151,7 +151,7 @@ mod map_reduce {
|
||||
reducer_response: recv<K: copy send, V: copy send> {
|
||||
reducer(Chan<reduce_proto<V>>) -> open<K, V>
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
enum reduce_proto<V: copy send> { emit_val(V), done, addref, release }
|
||||
|
||||
|
@ -2,11 +2,11 @@
|
||||
//
|
||||
// xfail-test
|
||||
|
||||
proto! streamp {
|
||||
proto! streamp (
|
||||
open:send<T: send> {
|
||||
data(T) -> open<T>
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
fn rendezvous() {
|
||||
let (c, s) = streamp::init();
|
||||
|
@ -1,8 +1,8 @@
|
||||
proto! stream {
|
||||
proto! stream (
|
||||
stream:send<T:send> {
|
||||
send(T) -> stream<T>
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
fn main() {
|
||||
let (bc, _bp) = stream::init();
|
||||
|
@ -11,7 +11,7 @@ type password = ~str;
|
||||
type money = float;
|
||||
type amount = float;
|
||||
|
||||
proto! bank {
|
||||
proto! bank (
|
||||
login:send {
|
||||
login(username, password) -> login_response
|
||||
}
|
||||
@ -30,7 +30,7 @@ proto! bank {
|
||||
money(money) -> connected,
|
||||
insufficient_funds -> connected
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
macro_rules! move_it (
|
||||
{ $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } }
|
||||
|
@ -9,11 +9,11 @@ import std::uv;
|
||||
|
||||
import pipes::{try_recv, recv};
|
||||
|
||||
proto! oneshot {
|
||||
proto! oneshot (
|
||||
waiting:send {
|
||||
signal -> !
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
fn main() {
|
||||
let iotask = uv::global_loop::get();
|
||||
|
@ -4,11 +4,11 @@ use std;
|
||||
import std::timer::sleep;
|
||||
import std::uv;
|
||||
|
||||
proto! oneshot {
|
||||
proto! oneshot (
|
||||
waiting:send {
|
||||
signal -> !
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
fn main() {
|
||||
let (c, p) = oneshot::init();
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
// xfail-pretty
|
||||
|
||||
proto! pingpong {
|
||||
proto! pingpong (
|
||||
ping:send {
|
||||
ping -> pong
|
||||
}
|
||||
@ -10,7 +10,7 @@ proto! pingpong {
|
||||
pong:recv {
|
||||
pong -> ping
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
mod test {
|
||||
import pipes::recv;
|
||||
|
@ -71,7 +71,7 @@ struct Buffer {
|
||||
drop { }
|
||||
}
|
||||
|
||||
proto! double_buffer {
|
||||
proto! double_buffer (
|
||||
acquire:send {
|
||||
request -> wait_buffer
|
||||
}
|
||||
@ -83,7 +83,7 @@ proto! double_buffer {
|
||||
release:send {
|
||||
release(Buffer) -> acquire
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// Code examples
|
||||
fn render(_buffer: &Buffer) {
|
||||
|
@ -1,13 +1,13 @@
|
||||
// xfail-pretty
|
||||
|
||||
// Protocols
|
||||
proto! foo {
|
||||
proto! foo (
|
||||
foo:recv {
|
||||
do_foo -> foo
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
proto! bar {
|
||||
proto! bar (
|
||||
bar:recv {
|
||||
do_bar(int) -> barbar,
|
||||
do_baz(bool) -> bazbar,
|
||||
@ -20,7 +20,7 @@ proto! bar {
|
||||
bazbar:send {
|
||||
rebazbar -> bar
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
fn macros() {
|
||||
include!("select-macro.rs");
|
||||
|
@ -7,17 +7,17 @@ import std::uv;
|
||||
|
||||
import pipes::{recv, select};
|
||||
|
||||
proto! oneshot {
|
||||
proto! oneshot (
|
||||
waiting:send {
|
||||
signal -> !
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
proto! stream {
|
||||
proto! stream (
|
||||
stream:send<T:send> {
|
||||
send(T) -> stream<T>
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
fn main() {
|
||||
import oneshot::client::*;
|
||||
|
@ -5,11 +5,11 @@ import std::timer::sleep;
|
||||
import std::uv;
|
||||
import pipes::recv;
|
||||
|
||||
proto! oneshot {
|
||||
proto! oneshot (
|
||||
waiting:send {
|
||||
signal -> !
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
fn main() {
|
||||
import oneshot::client::*;
|
||||
|
Loading…
x
Reference in New Issue
Block a user