Struct age_core::plugin::Connection
source · [−]Available on crate feature
plugin only.Expand description
A connection to a plugin binary.
Implementations
sourceimpl 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.
sourceimpl Connection<Stdin, Stdout>
impl Connection<Stdin, Stdout>
sourceimpl<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>>>)>where
F: Fn(Stanza) -> Result<A, E>,
G: Fn(Stanza) -> Result<B, E>,
H: Fn(Stanza) -> Result<C, 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>>>)>where
F: Fn(Stanza) -> Result<A, E>,
G: Fn(Stanza) -> Result<B, E>,
H: Fn(Stanza) -> Result<C, 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>where
R: Send,
W: Send,
impl<R, W> Sync for Connection<R, W>where
R: Sync,
W: Sync,
impl<R, W> Unpin for Connection<R, W>where
R: Unpin,
W: Unpin,
impl<R, W> UnwindSafe for Connection<R, W>where
R: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more