Skip to content

Commit 18a9e14

Browse files
authored
Merge pull request #15 from LFDT-Lockness/party-hard
Add methods to party to change its components
2 parents 100b267 + 5f09bc1 commit 18a9e14

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

round-based/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v0.4.1
2+
* Add methods to MpcParty to change its components [#15]
3+
14
## v0.4.0
25
* BREAKING: Improve ergonomics of protocol simulation, which is used for writing tests [#14]
36
* Remove `dev` feature, it's replaced with `sim` and `sim-async`

round-based/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "round-based"
3-
version = "0.4.0"
3+
version = "0.4.1"
44
edition = "2021"
55
license = "MIT OR Apache-2.0"
66
description = "Driver for MPC protocols"

round-based/src/party.rs

+20
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,26 @@ impl<M, D, X> MpcParty<M, D, X>
123123
where
124124
D: Delivery<M>,
125125
{
126+
/// Modify the delivery of this party while keeping everything else the same
127+
pub fn map_delivery<D2>(self, f: impl FnOnce(D) -> D2) -> MpcParty<M, D2, X> {
128+
let delivery = f(self.delivery);
129+
MpcParty {
130+
delivery,
131+
runtime: self.runtime,
132+
_msg: self._msg,
133+
}
134+
}
135+
136+
/// Modify the runtime of this party while keeping everything else the same
137+
pub fn map_runtime<R>(self, f: impl FnOnce(X) -> R) -> MpcParty<M, D, R> {
138+
let runtime = f(self.runtime);
139+
MpcParty {
140+
delivery: self.delivery,
141+
runtime,
142+
_msg: self._msg,
143+
}
144+
}
145+
126146
/// Specifies a [async runtime](runtime)
127147
pub fn set_runtime<R>(self, runtime: R) -> MpcParty<M, D, R>
128148
where

0 commit comments

Comments
 (0)