pub struct Sidecar {
pub hello: Value,
pub pid: u32,
pub events: Vec<Value>,
pub legacy_status_frames: bool,
/* private fields */
}Expand description
A running --stdio sidecar speaking
{"type":"request","id":N,"method":{"method":"command","params":{"name","input"}}}
and answering {"type":"response","status":"ok|err","id":N,"result|error":...}.
Fields§
§hello: Value§pid: u32§events: Vec<Value>Frames that were neither hello nor the awaited response (events), oldest first. Once the
list reaches twice the event limit (default 2,048, see Sidecar::set_event_limit) the
oldest are trimmed back to the limit; SidecarStatus::events_dropped counts them.
legacy_status_frames: boolForces the old GenRight status frames for every command when true. false does not
force jobs frames: the shape then comes from the hello (see Sidecar::set_frame_shape
to pin the jobs contract against a legacy hello).
Implementations§
Source§impl Sidecar
impl Sidecar
Sourcepub fn status(&self) -> SidecarStatus
pub fn status(&self) -> SidecarStatus
Buffer counts and process resource usage, read now. No polling thread runs for this.
Sourcepub fn set_event_limit(&mut self, limit: usize)
pub fn set_event_limit(&mut self, limit: usize)
Keeps the most recent limit frames in Sidecar::events (default 2,048). Frames beyond
the new limit are trimmed now, and the list is trimmed again once it reaches twice the limit.
Sourcepub fn set_stderr_limit(&mut self, bytes: usize)
pub fn set_stderr_limit(&mut self, bytes: usize)
Keeps the last bytes of engine stderr in memory (default 256 KiB).
pub fn stderr_tail(&self) -> String
Sourcepub fn raw(&mut self, frame: Value, timeout: Duration) -> Result<Value>
pub fn raw(&mut self, frame: Value, timeout: Duration) -> Result<Value>
Send an arbitrary frame and return the response with the same id.
Sourcepub fn command(
&mut self,
name: &str,
input: Value,
timeout: Duration,
) -> Result<Value>
pub fn command( &mut self, name: &str, input: Value, timeout: Duration, ) -> Result<Value>
A command. Default is the rightkit-job-queue contract: {type:"request", id, method: name, params: input} answered by {type:"response", id, ok, result | error:{code,message}}.
With legacy_status_frames the old GenRight shape is used (method:{method:"command", params:{name,input}}, answered with status: ok|err). The shape a hello announces is
used when nothing is set; see Sidecar::resolve_shape.
pub fn command_with( &mut self, name: &str, input: Value, timeout: Duration, legacy_status_frames: Option<bool>, ) -> Result<Value>
Sourcepub fn set_frame_shape(&mut self, legacy: Option<bool>)
pub fn set_frame_shape(&mut self, legacy: Option<bool>)
Pins the frame shape for every command on this sidecar: Some(true) the legacy GenRight
frames, Some(false) the rightkit-job-queue contract, None clears the pin. A per-command
Option still wins over the pin.