Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Key hashable #29

Merged
merged 3 commits into from
Aug 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "constellation-rs"
version = "0.1.3"
version = "0.1.4"
license = "Apache-2.0"
authors = ["Alec Mocatta <alec@mocatta.net>"]
categories = ["development-tools","network-programming","concurrency","asynchronous","command-line-utilities"]
Expand All @@ -12,7 +12,7 @@ Constellation is a framework for Rust (nightly) that aides in the writing, debug
"""
repository = "https://github.com/alecmocatta/constellation"
homepage = "https://github.com/alecmocatta/constellation"
documentation = "https://docs.rs/constellation-rs/0.1.3"
documentation = "https://docs.rs/constellation-rs/0.1.4"
readme = "README.md"
edition = "2018"
autotests = true
Expand All @@ -32,7 +32,7 @@ fringe = ["serde_pipe/fringe"]
no_alloc = ["constellation-internal/no_alloc"]

[dependencies]
constellation-internal = { path = "constellation-internal", version = "=0.1.3" }
constellation-internal = { path = "constellation-internal", version = "=0.1.4" }
atty = "0.2"
backtrace = "0.3"
bincode = "1.0"
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</p>

<p align="center">
<a href="https://docs.rs/constellation-rs/0.1.3">Docs</a>
<a href="https://docs.rs/constellation-rs/0.1.4">Docs</a>
</p>

Constellation is a framework for Rust (nightly) that aides in the writing, debugging and deployment of distributed programs. It draws heavily from [Erlang/OTP](https://en.wikipedia.org/wiki/Erlang_(programming_language)), [MPI](https://en.wikipedia.org/wiki/Message_Passing_Interface), and [CSP](https://en.wikipedia.org/wiki/Communicating_sequential_processes); and leverages the Rust ecosystem where it can including [serde](https://serde.rs/) + [bincode](https://github.com/servo/bincode) for network serialization, and [mio](https://github.com/tokio-rs/mio) and [futures-rs](https://github.com/rust-lang-nursery/futures-rs) for asynchronous channels over TCP.
Expand All @@ -27,13 +27,13 @@ For leveraging Constellation directly, read on.

## Constellation framework

* Constellation is a framework that's initialised with a call to [`init()`](https://docs.rs/constellation-rs/0.1.3/constellation/fn.init.html) at the beginning of your program.
* You can [`spawn(closure)`](https://docs.rs/constellation-rs/0.1.3/constellation/fn.spawn.html) new processes, which run `closure`.
* Constellation is a framework that's initialised with a call to [`init()`](https://docs.rs/constellation-rs/0.1.4/constellation/fn.init.html) at the beginning of your program.
* You can [`spawn(closure)`](https://docs.rs/constellation-rs/0.1.4/constellation/fn.spawn.html) new processes, which run `closure`.
* `spawn(closure)` returns the Pid of the new process.
* You can communicate between processes by creating channels with [`Sender::new(remote_pid)`](https://docs.rs/constellation-rs/0.1.3/constellation/struct.Sender.html#method.new) and [`Receiver::new(remote_pid)`](https://docs.rs/constellation-rs/0.1.3/constellation/struct.Receiver.html#method.new).
* Channels can be used asynchronously with [`sender.send(value).await`](https://docs.rs/constellation-rs/0.1.3/constellation/struct.Sender.html#method.send) and [`receiver.recv().await`](https://docs.rs/constellation-rs/0.1.3/constellation/struct.Receiver.html#method.recv).
* You can communicate between processes by creating channels with [`Sender::new(remote_pid)`](https://docs.rs/constellation-rs/0.1.4/constellation/struct.Sender.html#method.new) and [`Receiver::new(remote_pid)`](https://docs.rs/constellation-rs/0.1.4/constellation/struct.Receiver.html#method.new).
* Channels can be used asynchronously with [`sender.send(value).await`](https://docs.rs/constellation-rs/0.1.4/constellation/struct.Sender.html#method.send) and [`receiver.recv().await`](https://docs.rs/constellation-rs/0.1.4/constellation/struct.Receiver.html#method.recv).
* [futures-rs](https://github.com/rust-lang-nursery/futures-rs) provides useful functions and adapters including `select()` and `join()` for working with channels.
* You can also block on channels with the [`.block()`](https://docs.rs/constellation-rs/0.1.3/constellation/trait.FutureExt1.html#method.block) convenience method: `sender.send().block()` and `receiver.recv().block()`.
* You can also block on channels with the [`.block()`](https://docs.rs/constellation-rs/0.1.4/constellation/trait.FutureExt1.html#method.block) convenience method: `sender.send().block()` and `receiver.recv().block()`.
* For more information on asynchronous programming in Rust check out the [Async Book](https://rust-lang.github.io/async-book/index.html)!

Here's a simple example recursively spawning processes to distribute the task of finding Fibonacci numbers:
Expand Down Expand Up @@ -248,7 +248,7 @@ Please file an issue if you experience any other requirements.

## API

[see Rust doc](https://docs.rs/constellation-rs/0.1.3)
[see Rust doc](https://docs.rs/constellation-rs/0.1.4)

## Testing

Expand Down
5 changes: 1 addition & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
trigger: ["master"]
pr:
autoCancel: false
branches:
include: ["master"]
pr: ["master"]

resources:
repositories:
Expand Down
4 changes: 2 additions & 2 deletions constellation-internal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "constellation-internal"
version = "0.1.3"
version = "0.1.4"
license = "Apache-2.0"
authors = ["Alec Mocatta <alec@mocatta.net>"]
categories = ["development-tools","network-programming","concurrency","asynchronous"]
Expand All @@ -10,7 +10,7 @@ Common components for the `constellation` framework.
"""
repository = "https://github.com/alecmocatta/constellation"
homepage = "https://github.com/alecmocatta/constellation"
documentation = "https://docs.rs/constellation-internal/0.1.3"
documentation = "https://docs.rs/constellation-internal/0.1.4"
edition = "2018"

[features]
Expand Down
2 changes: 1 addition & 1 deletion constellation-internal/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![doc(html_root_url = "https://docs.rs/constellation-internal/0.1.3")]
#![doc(html_root_url = "https://docs.rs/constellation-internal/0.1.4")]
#![warn(
// missing_copy_implementations,
missing_debug_implementations,
Expand Down
2 changes: 1 addition & 1 deletion src/channel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use super::Fd;
pub use self::{inner::*, inner_states::*};
pub use tcp_typed::{socket_forwarder, SocketForwardee, SocketForwarder};

#[derive(Copy, Clone, PartialEq, Eq)]
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
struct Key(*const ());
/// Because `*const ()`. Pointers aren't really not Send+Sync, it's more of a lint.
unsafe impl marker::Send for Key {}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//!
//! The only requirement to use is that [`init()`](init) must be called immediately inside your application's `main()` function.

#![doc(html_root_url = "https://docs.rs/constellation-rs/0.1.3")]
#![doc(html_root_url = "https://docs.rs/constellation-rs/0.1.4")]
#![cfg_attr(feature = "nightly", feature(read_initializer))]
#![feature(cfg_doctest)]
#![warn(
Expand Down