Struct age_core::plugin::Connection
source · pub struct Connection<R: Read, W: Write> { /* private fields */ }
Available on crate feature
plugin
only.Expand description
A connection to a plugin binary.
Implementations§
source§impl Connection<DebugReader<ChildStdout>, DebugWriter<ChildStdin>>
impl Connection<DebugReader<ChildStdout>, DebugWriter<ChildStdin>>
sourcepub fn open(binary: &Path, state_machine: &str) -> Result<Self>
pub fn open(binary: &Path, state_machine: &str) -> Result<Self>
Starts a plugin binary with the given state machine.
If the AGEDEBUG
environment variable is set to plugin
, then all messages sent
to and from the plugin, as well as anything the plugin prints to its stderr
,
will be printed to the stderr
of the parent process.
source§impl Connection<Stdin, Stdout>
impl Connection<Stdin, Stdout>
source§impl<R: Read, W: Write> Connection<R, W>
impl<R: Read, W: Write> Connection<R, W>
sourcepub fn unidir_send<P: FnOnce(UnidirSend<'_, R, W>) -> Result<()>>(
&mut self,
phase_steps: P
) -> Result<()>
pub fn unidir_send<P: FnOnce(UnidirSend<'_, R, W>) -> Result<()>>( &mut self, phase_steps: P ) -> Result<()>
Runs a unidirectional phase as the controller.
sourcepub fn unidir_receive<A, B, C, E, F, G, H>(
&mut self,
command_a: (&str, F),
command_b: (&str, G),
command_c: (Option<&str>, H)
) -> Result<(Result<Vec<A>, Vec<E>>, Result<Vec<B>, Vec<E>>, Option<Result<Vec<C>, Vec<E>>>)>
pub fn unidir_receive<A, B, C, E, F, G, H>( &mut self, command_a: (&str, F), command_b: (&str, G), command_c: (Option<&str>, H) ) -> Result<(Result<Vec<A>, Vec<E>>, Result<Vec<B>, Vec<E>>, Option<Result<Vec<C>, Vec<E>>>)>
Runs a unidirectional phase as the recipient.
§Arguments
command_a
, command_b
, and (optionally) command_c
are the known commands that
are expected to be received. All other received commands (including grease) will
be ignored.
Auto Trait Implementations§
impl<R, W> RefUnwindSafe for Connection<R, W>where
R: RefUnwindSafe,
W: RefUnwindSafe,
impl<R, W> Send for Connection<R, W>
impl<R, W> Sync for Connection<R, W>
impl<R, W> Unpin for Connection<R, W>
impl<R, W> UnwindSafe for Connection<R, W>where
R: UnwindSafe,
W: UnwindSafe,
Blanket Implementations§
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