pub struct Channel {
pub name_hash: u64,
pub state: Vec<NQuin>,
pub constraints: Vec<Constraint>,
pub lamport: u64,
pub frozen: bool,
}Expand description
A named observable state channel on the blackboard.
Fields§
§name_hash: u64Channel name (hashed for lookup).
state: Vec<NQuin>Current state Quins on this channel.
constraints: Vec<Constraint>Constraints pinned to this channel.
lamport: u64Lamport clock for this channel.
frozen: boolWhether this channel is read-only (frozen).
Implementations§
Source§impl Channel
impl Channel
Sourcepub fn new(name_hash: u64) -> Self
pub fn new(name_hash: u64) -> Self
Create an empty channel for name_hash (writeable, Lamport 0,
no constraints).
Sourcepub fn write(&mut self, quin: NQuin) -> Result<(), String>
pub fn write(&mut self, quin: NQuin) -> Result<(), String>
Write a Quin to this channel’s state.
Sourcepub fn add_constraint(&mut self, constraint: Constraint) -> Result<(), String>
pub fn add_constraint(&mut self, constraint: Constraint) -> Result<(), String>
Add a constraint to this channel.
Sourcepub fn check_constraints(&self) -> Vec<ConstraintViolation>
pub fn check_constraints(&self) -> Vec<ConstraintViolation>
Check all constraints against the current state.
Sourcepub fn pinned_constraints(&self) -> Vec<Constraint>
pub fn pinned_constraints(&self) -> Vec<Constraint>
Get pinned constraints (for propagation to downstream).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Channel
impl RefUnwindSafe for Channel
impl Send for Channel
impl Sync for Channel
impl Unpin for Channel
impl UnsafeUnpin for Channel
impl UnwindSafe for Channel
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more