gix_filter::driver::process

Struct Server

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

A handle to facilitate typical server interactions that include the handshake and command-invocations.

Implementations§

Source§

impl Server

Source

pub fn handshake( stdin: Stdin, stdout: Stdout, welcome_prefix: &str, pick_version: &mut dyn FnMut(&[usize]) -> Option<usize>, available_capabilities: &[&str], ) -> Result<Self, Error>

Perform a handshake with the client sending information to our stdin and receiving information through our stdout in packetline format. pick_version is called with all versions supported by the client to pick one from, or None to indicate the handshake should stop. Use available_capabilities to match our capabilities with the ones from the client, so we communicate at most a subset of these.

§Note

The server claims exclusive access over stdout and stdin, so all kinds of other output has to be steered towards stderr or there will be a deadlock.

Source

pub fn next_request(&mut self) -> Result<Option<Request<'_>>, Error>

Read the next request and return it, even if command is not supported by us. If Ok(None) is reported, the request loop should end and the process should be shutdown gracefully.

The reason for allowing any command is that the caller would have to match on the command anyway, and would have to handle invalid commands that way.

§Lifecycle

Note that the process is supposed to shut-down once there are no more requests, and git will wait until it has finished.

Source§

impl Server

Access

Source

pub fn capabilities(&self) -> &HashSet<String>

Return the list of capabilities we are allowed to use, as negotiated with the client.

Source

pub fn version(&self) -> usize

Return the negotiated version of the protocol.

Auto Trait Implementations§

§

impl Freeze for Server

§

impl RefUnwindSafe for Server

§

impl !Send for Server

§

impl !Sync for Server

§

impl Unpin for Server

§

impl UnwindSafe for Server

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.