Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 89e201a0 authored by WILLIAMS Harvey's avatar WILLIAMS Harvey
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
/target
/d2
\ No newline at end of file
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "async-trait"
version = "0.1.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d556ec1359574147ec0c4fc5eb525f3f23263a592b1a9c07e0a75b427de55c97"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "proc-macro2"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rust-networking-examples"
version = "0.1.0"
dependencies = [
"async-trait",
]
[[package]]
name = "syn"
version = "2.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[package]
name = "rust-networking-examples"
version = "0.1.0"
edition = "2021"
[dependencies]
async-trait = "0.1.87"
# rust-networking-examples
<img src="misc/uml.png">
Are you...
- A new PhD student/engineer who is a beginner with the language.
- Someone unfamiliar with the libraries available for writing distributed rust programs.
- A person who just wants to build a distributed application that supports basic networking with minimal fuss.
This repository might be helpful for you!
# Structure
`/` Rust library containing the Network interface, nothing else.
`/examples/` Examples implementing the Network interface using different methods for transport.
# Prerequisites
- Some basic understanding of writing async rust code. Alhough you can opt to write your application code in a synchronous manner, we opt to use it here to handle events.
- A familiarity with the actor model/pattern of writing async code.
\ No newline at end of file
misc/uml.png

167 KiB

/// Our Network interface which is accomplished through a language feature of Rust called 'traits'
///
/// Note the async_trait annotation; this adds support for defining async functions as part of your interface. The stable version of rust currently doesn't have this, so we rely on a crate for as a workaround.
#[async_trait::async_trait]
pub trait Network {
/// Send a message to the identifier specified by the 'to' field.
fn send(to: &str, message: Vec<u8>);
/// Wait for a message to be received
async fn recv() -> Option<(String, Vec<u8>)>;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment