gix_filter::driver::process

Struct Client

Source
pub struct Client { /* private fields */ }
Expand description

A handle to a client that allows communicating to a long-running process.

Implementations§

Source§

impl Client

Protocol implementation

Source

pub fn handshake( process: Child, welcome_prefix: &str, versions: &[usize], desired_capabilities: &[&str], ) -> Result<Self, Error>

Given a spawned process as created from cmd, use the ‘long-running-process’ protocol to send welcome-prefix and supported versions, along with the desired_capabilities, and perform the handshake to negotiate a version to use along with obtaining supported capabilities, which may be a sub-set of the desired capabilities.

Source

pub fn invoke( &mut self, command: &str, meta: &mut dyn Iterator<Item = (&str, BString)>, content: &mut dyn Read, ) -> Result<Status, Error>

Invoke command and send all meta data before sending all content in full.

Source

pub fn invoke_without_content<'a>( &mut self, command: &str, meta: &mut dyn Iterator<Item = (&'a str, BString)>, inspect_line: &mut dyn FnMut(&BStr), ) -> Result<Status, Error>

Invoke command while passing meta data, but don’t send any content, and return their status. Call inspect_line for each line that we see as command response.

This is for commands that don’t expect a content stream.

Source

pub fn as_read(&mut self) -> impl Read + '_

Return a Read implementation that reads the server process output until the next flush package, and validates the status. If the status indicates failure, the last read will also fail.

Source

pub fn read_status(&mut self) -> Result<Status>

Read a status= line from the process output until it is exhausted. Note that the last sent status line wins and no status line means that the Previous still counts.

Source§

impl Client

Access

Source

pub fn capabilities(&self) -> &Capabilities

Return the list of capabilities reported by the serving process.

Source

pub fn capabilities_mut(&mut self) -> &mut Capabilities

Return the mutable list of capabilities reported by the serving process.

Source

pub fn version(&self) -> usize

Return the negotiated version of the protocol.

Note that it is the highest one that both the client and the server support.

Source§

impl Client

Lifecycle

Source

pub fn into_child(self) -> Child

Return the child handle of the running process.

Note that this will naturally close input and output handles, which is a signal for the child process to shutdown.

Auto Trait Implementations§

§

impl Freeze for Client

§

impl RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl UnwindSafe for Client

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.