pub struct PluginExecutor { /* private fields */ }Expand description
Demultiplex many in-flight CommandRequest calls over a plugin’s
stdin/stdout. Each execute mints a fresh id, emits a
Output::Command(Command { id, command }) line on the plugin’s stdout,
and returns a stream that yields whatever the overlord writes back
to the plugin’s stdin under the same id.
Only one instance per process — the constructor consumes the global
tokio::io::stdin() / stdout() handles.
Implementations§
Trait Implementations§
Source§impl CommandExecutor for PluginExecutor
impl CommandExecutor for PluginExecutor
type Error = Error
type Stream<T> = Pin<Box<dyn Stream<Item = Result<T, Error>> + Send>> where T: Send + 'static
async fn execute<R, T>( &self, request: R, _agent_arguments: Option<&AgentArguments>, ) -> Result<Self::Stream<T>, Error>
Source§async fn execute_one<R, T>(
&self,
request: R,
agent_arguments: Option<&AgentArguments>,
) -> Result<T, Error>
async fn execute_one<R, T>( &self, request: R, agent_arguments: Option<&AgentArguments>, ) -> Result<T, Error>
Convenience for unary commands: run the request and resolve the
first item from the stream. Implementations should error with
their own “empty stream” variant if the stream closes without
producing an item.
Auto Trait Implementations§
impl !Freeze for PluginExecutor
impl !RefUnwindSafe for PluginExecutor
impl !UnwindSafe for PluginExecutor
impl Send for PluginExecutor
impl Sync for PluginExecutor
impl Unpin for PluginExecutor
impl UnsafeUnpin for PluginExecutor
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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