Skip to main content

ExternalSource

Struct ExternalSource 

Source
pub struct ExternalSource {
    pub sent: Vec<String>,
    pub trace: bool,
    /* private fields */
}
Expand description

A connected adapter.

Fields§

§sent: Vec<String>

Every request line sent, without the newline (for tests and traces).

§trace: bool

Keep the trace (off by default: production sends are not retained).

Implementations§

Source§

impl ExternalSource

Source

pub fn spawn( command: &str, args: &[String], env: &BTreeMap<String, String>, ) -> Result<Self>

Spawn command args… with env merged over the parent’s and connect.

Source

pub fn spawn_source(source: &SourceRow, adapter: &AdapterRow) -> Result<Self>

Spawn a registry source: the adapter’s command, its fixed args, then render_config_flags(source.config); the source’s env.

Source

pub fn argv(source: &SourceRow, adapter: &AdapterRow) -> Vec<String>

The argv an adapter is spawned with (§5), for callers that log it.

Source

pub fn connect( label: &str, from_adapter: impl Read + Send + 'static, to_adapter: impl Write + Send + 'static, ) -> Result<Self>

Connect over an arbitrary pair of streams (the adapter’s stdout to read, its stdin to write) — a test or a runner playing a scripted adapter over pipes. label names the adapter in errors.

Source

pub fn command(&self) -> &str

The label/command this source was spawned as.

Source

pub fn call(&mut self, method: &str, params: Value) -> Result<Value>

One request/response round trip: {"id":n,"method":m,"params":{…}}, then responses until the one with our id (others are dropped, as the reference does); {"error": …} fails.

Source

pub fn alive(&mut self) -> bool

Whether the child (if any) is still running.

Trait Implementations§

Source§

impl Debug for ExternalSource

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for ExternalSource

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl SyncSource for ExternalSource

Source§

fn unwatch(&mut self) -> Result<()>

Stop listening, then unwatch; a failure (the process may be exiting) is ignored.

Source§

fn close(&mut self) -> Result<()>

Close stdin (EOF), give the adapter a moment to exit, then SIGTERM, then SIGKILL; reap it.

Source§

fn capabilities(&self) -> SourceCapabilities

Source§

fn enumerate(&mut self) -> Result<Vec<SourceEntry>>

The full current scope.
Source§

fn fetch(&mut self, path: &str) -> Result<Option<SourceItem>>

One member’s current state, or None when it left the scope.
Source§

fn write(&mut self, path: &str, content: &str) -> Result<()>

Persist engine-authored bytes (write-through sources only).
Source§

fn remove(&mut self, path: &str) -> Result<()>

Remove a member (write-through sources only).
Source§

fn watch(&mut self) -> Result<Receiver<Vec<String>>>

Subscribe to change batches: each received value is one batch of changed paths (watching sources only).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.