Skip to content

Commit 53823ec

Browse files
author
Jared Stanbrough
committed
feat(rust): ockam_core crate v0.4.0
1 parent 1374d40 commit 53823ec

23 files changed

Lines changed: 43 additions & 27 deletions

File tree

implementations/rust/ockam/ockam/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

implementations/rust/ockam/ockam/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ no_std = ["ockam_core/no_std", "serde"]
2525
bbs = { version = "0.4", optional = true }
2626
digest = { version = "0.8", optional = true }
2727
ff = { version = "0.6", package = "ff-zeroize", optional = true }
28-
ockam_core = {path = "../ockam_core", version = "0.3.0"}
28+
ockam_core = {path = "../ockam_core", version = "0.4.0"}
2929
ockam_node = {path = "../ockam_node", version = "0.2.0", optional = true}
3030
ockam_node_attribute = {path = "../ockam_node_attribute", version = "0.1.3"}
3131
ockam_vault_core = {path = "../ockam_vault_core", version = "0.2.0"}

implementations/rust/ockam/ockam_core/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to this crate will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## v0.4.0 - 2021-03-03
9+
### Added
10+
11+
- Auto-implemenation of the `Message` trait for certain types.
12+
13+
### Modified
14+
15+
- The `Worker` trait and its methods are now async.
16+
- Updated dependencies.
17+
818
## v0.3.0 - 2021-02-16
919
### Added
1020

implementations/rust/ockam/ockam_core/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

implementations/rust/ockam/ockam_core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ockam_core"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
authors = ["Ockam Developers"]
55
edition = "2018"
66
license = "Apache-2.0"

implementations/rust/ockam/ockam_core/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Add this to your `Cargo.toml`:
2121

2222
```
2323
[dependencies]
24-
ockam_core = "0.3.0"
24+
ockam_core = "0.4.0"
2525
```
2626

2727
## Crate Features
@@ -32,7 +32,7 @@ disabled as follows
3232

3333
```
3434
[dependencies]
35-
ockam_core = { version = "0.3.0", default-features = false }
35+
ockam_core = { version = "0.4.0", default-features = false }
3636
```
3737

3838
Please note that Cargo features are unioned across the entire dependency

implementations/rust/ockam/ockam_core/src/address.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::lib::{
55
use core::ops::Deref;
66
use serde::{Deserialize, Serialize};
77

8+
/// An external identifier for message routing.
89
#[derive(Debug, Clone, Hash, Ord, PartialOrd, Eq, PartialEq, Serialize, Deserialize)]
910
pub struct Address(Vec<u8>);
1011

implementations/rust/ockam/ockam_core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! The main Ockam crate re-exports types defined in this crate.
88
#![no_std]
99
#![deny(
10-
// missing_docs,
10+
missing_docs,
1111
trivial_casts,
1212
trivial_numeric_casts,
1313
unsafe_code,

implementations/rust/ockam/ockam_core/src/message.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ use crate::lib::Vec;
22
use crate::Result;
33
use serde::{de::DeserializeOwned, Serialize};
44

5-
// TODO: swap this for a non-heaped data structure
5+
/// Alias of the type used for encoded data.
66
pub type Encoded = Vec<u8>;
77

88
/// A user defined message that can be serialised and deserialised
99
pub trait Message: Serialize + DeserializeOwned + Send + 'static {
10+
/// Encode the type representation into an [`Encoded`] type.
1011
fn encode(&self) -> Result<Encoded> {
1112
Ok(bincode::serialize(self)?)
1213
}
1314

15+
/// Decode an [`Encoded`] type into the Message's type.
1416
#[allow(clippy::ptr_arg)]
1517
fn decode(e: &Encoded) -> Result<Self> {
1618
Ok(bincode::deserialize(e)?)

implementations/rust/ockam/ockam_core/src/worker.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ use async_trait::async_trait;
44
/// Base ockam worker trait.
55
#[async_trait]
66
pub trait Worker: Send + 'static {
7+
/// The type of Message the Worker is sent in [`Self::handle_message`]
78
type Message: Message;
9+
10+
/// The API and other resources available for the worker during message processing.
811
type Context: Send + 'static;
912

1013
/// Override initialisation behaviour

0 commit comments

Comments
 (0)