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, D, E, F, G, H, I>(
&mut self,
command_a: (&str, F),
command_b: (&str, G),
command_c: (Option<&str>, H),
command_d: (Option<&str>, I),
) -> Result<(Result<Vec<A>, Vec<E>>, Result<Vec<B>, Vec<E>>, Option<Result<Vec<C>, Vec<E>>>, Option<Result<Vec<D>, Vec<E>>>)>
pub fn unidir_receive<A, B, C, D, E, F, G, H, I>( &mut self, command_a: (&str, F), command_b: (&str, G), command_c: (Option<&str>, H), command_d: (Option<&str>, I), ) -> Result<(Result<Vec<A>, Vec<E>>, Result<Vec<B>, Vec<E>>, Option<Result<Vec<C>, Vec<E>>>, Option<Result<Vec<D>, Vec<E>>>)>
Runs a unidirectional phase as the recipient.
§Arguments
command_a
, command_b
, and (optionally) command_c
and command_d
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> Freeze for Connection<R, W>
impl<R, W> RefUnwindSafe for Connection<R, W>where
W: RefUnwindSafe,
R: 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
W: UnwindSafe,
R: 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