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. The struct is Clone
so callers that need a second handle can share without an outer
Arc: every field is already behind Arc, including counter, so
clones share the id sequence and pending map.
Implementations§
Trait Implementations§
Source§impl Clone for PluginExecutor
impl Clone for PluginExecutor
Source§fn clone(&self) -> PluginExecutor
fn clone(&self) -> PluginExecutor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§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>where
R: CommandRequest + Send,
T: CommandResponseTrait + Serialize + DeserializeOwned + Send + 'static,
Source§async fn execute_one<R, T>(
&self,
request: R,
agent_arguments: Option<&AgentArguments>,
) -> Result<T, Error>where
R: CommandRequest + Send,
T: CommandResponseTrait + Serialize + DeserializeOwned + Send + 'static,
async fn execute_one<R, T>(
&self,
request: R,
agent_arguments: Option<&AgentArguments>,
) -> Result<T, Error>where
R: CommandRequest + Send,
T: CommandResponseTrait + Serialize + DeserializeOwned + Send + 'static,
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 !RefUnwindSafe for PluginExecutor
impl !UnwindSafe for PluginExecutor
impl Freeze 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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