pub struct ProgramBuilder<R: RoleId, M> { /* private fields */ }Expand description
Builder for choreographic programs that enforces structural invariants.
Implementations§
Source§impl<R: RoleId, M> ProgramBuilder<R, M>
impl<R: RoleId, M> ProgramBuilder<R, M>
Sourcepub fn try_send(self, to: R, msg: M) -> Result<Self, ProgramError>
pub fn try_send(self, to: R, msg: M) -> Result<Self, ProgramError>
Fallible send.
Sourcepub fn try_recv<T: 'static>(self, from: R) -> Result<Self, ProgramError>
pub fn try_recv<T: 'static>(self, from: R) -> Result<Self, ProgramError>
Fallible recv.
Sourcepub fn try_choose(
self,
at: R,
label: <R as RoleId>::Label,
) -> Result<Self, ProgramError>
pub fn try_choose( self, at: R, label: <R as RoleId>::Label, ) -> Result<Self, ProgramError>
Fallible choose.
Sourcepub fn try_offer(self, from: R) -> Result<Self, ProgramError>
pub fn try_offer(self, from: R) -> Result<Self, ProgramError>
Fallible offer.
Sourcepub fn try_with_timeout(
self,
at: R,
dur: Duration,
body: Program<R, M>,
) -> Result<Self, ProgramError>
pub fn try_with_timeout( self, at: R, dur: Duration, body: Program<R, M>, ) -> Result<Self, ProgramError>
Fallible with_timeout.
Sourcepub fn with_timeout(self, at: R, dur: Duration, body: Program<R, M>) -> Self
pub fn with_timeout(self, at: R, dur: Duration, body: Program<R, M>) -> Self
Add a timeout effect.
Sourcepub fn with_timed_choice(
self,
at: R,
dur: Duration,
body: Program<R, M>,
on_timeout: Program<R, M>,
) -> Self
pub fn with_timed_choice( self, at: R, dur: Duration, body: Program<R, M>, on_timeout: Program<R, M>, ) -> Self
Add a timed choice effect - races body against timeout.
If body completes before timeout, executes body. If timeout fires first, executes on_timeout instead. This is the effect-level representation of timed_choice syntax.
Sourcepub fn try_parallel(
self,
programs: Vec<Program<R, M>>,
) -> Result<Self, ProgramError>
pub fn try_parallel( self, programs: Vec<Program<R, M>>, ) -> Result<Self, ProgramError>
Add a parallel composition effect.
Sourcepub fn try_branch(
self,
choosing_role: R,
branches: Vec<(<R as RoleId>::Label, Program<R, M>)>,
) -> Result<Self, ProgramError>
pub fn try_branch( self, choosing_role: R, branches: Vec<(<R as RoleId>::Label, Program<R, M>)>, ) -> Result<Self, ProgramError>
Add a branch effect with multiple labeled continuations.
Sourcepub fn branch(
self,
choosing_role: R,
branches: Vec<(<R as RoleId>::Label, Program<R, M>)>,
) -> Self
pub fn branch( self, choosing_role: R, branches: Vec<(<R as RoleId>::Label, Program<R, M>)>, ) -> Self
Add a branch effect with multiple labeled continuations.
Sourcepub fn try_loop_n(
self,
iterations: usize,
body: Program<R, M>,
) -> Result<Self, ProgramError>
pub fn try_loop_n( self, iterations: usize, body: Program<R, M>, ) -> Result<Self, ProgramError>
Add a loop effect.
Sourcepub fn try_loop_inf(self, body: Program<R, M>) -> Result<Self, ProgramError>
pub fn try_loop_inf(self, body: Program<R, M>) -> Result<Self, ProgramError>
Add an infinite loop effect (or until break).
Sourcepub fn loop_inf(self, body: Program<R, M>) -> Self
pub fn loop_inf(self, body: Program<R, M>) -> Self
Add an infinite loop effect (or until break).
Sourcepub fn try_ext<E: ExtensionEffect<R> + 'static>(
self,
extension: E,
) -> Result<Self, ProgramError>
pub fn try_ext<E: ExtensionEffect<R> + 'static>( self, extension: E, ) -> Result<Self, ProgramError>
Add a domain-specific extension effect.
Sourcepub fn ext<E: ExtensionEffect<R> + 'static>(self, extension: E) -> Self
pub fn ext<E: ExtensionEffect<R> + 'static>(self, extension: E) -> Self
Add a domain-specific extension effect.
Sourcepub fn try_exts<E: ExtensionEffect<R> + 'static>(
self,
extensions: impl IntoIterator<Item = E>,
) -> Result<Self, ProgramError>
pub fn try_exts<E: ExtensionEffect<R> + 'static>( self, extensions: impl IntoIterator<Item = E>, ) -> Result<Self, ProgramError>
Add multiple extension effects.
Sourcepub fn exts<E: ExtensionEffect<R> + 'static>(
self,
extensions: impl IntoIterator<Item = E>,
) -> Self
pub fn exts<E: ExtensionEffect<R> + 'static>( self, extensions: impl IntoIterator<Item = E>, ) -> Self
Add multiple extension effects.
Sourcepub fn end(self) -> Program<R, M>
pub fn end(self) -> Program<R, M>
Mark the end of the program and finalize it.
Prefer ProgramBuilder::try_end for fallible construction.
Sourcepub fn try_end(self) -> Result<Program<R, M>, ProgramError>
pub fn try_end(self) -> Result<Program<R, M>, ProgramError>
Fallible variant of ProgramBuilder::end.
Sourcepub fn build(self) -> Result<Program<R, M>, ProgramError>
pub fn build(self) -> Result<Program<R, M>, ProgramError>
Validate and build the program without appending End.
Trait Implementations§
Source§impl<R: Clone + RoleId, M: Clone> Clone for ProgramBuilder<R, M>
impl<R: Clone + RoleId, M: Clone> Clone for ProgramBuilder<R, M>
Source§fn clone(&self) -> ProgramBuilder<R, M>
fn clone(&self) -> ProgramBuilder<R, M>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more