Skip to main content

HelperChain

Struct HelperChain 

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

Try each helper in order on fill, broadcast approve / reject.

Typical wiring puts a CachingHelper before a GitCredentialHelper: the cache short-circuits the slow shell-out path once a working pair has resolved, and approvals propagate so subsequent calls hit the cache.

Implementations§

Source§

impl HelperChain

Source

pub fn new(helpers: Vec<Box<dyn Helper>>) -> Self

Build a chain from a list of boxed helpers, applied in order.

Source

pub fn is_empty(&self) -> bool

true if no helpers are configured.

Calls into Helper::fill will always return Ok(None) for an empty chain.

Trait Implementations§

Source§

impl Helper for HelperChain

Source§

fn fill(&self, query: &Query) -> Result<Option<Credentials>, HelperError>

Walk helpers in order. The first to return creds wins; helpers that error out are logged and skipped so a busted askpass program can’t lock the user out of git credential further down the chain. Mirrors upstream’s CredentialHelpers.Fill at creds/creds.go:502. If nothing returned creds and at least one helper errored, surface the last error so callers see why nothing worked rather than a bare “credentials not found”.

Source§

fn approve(&self, query: &Query, creds: &Credentials) -> Result<(), HelperError>

Broadcast to every helper. Errors from individual helpers are surfaced (first wins) — a failed approve generally means we couldn’t write to the keystore, which is worth knowing about.

Source§

fn reject(&self, query: &Query, creds: &Credentials) -> Result<(), HelperError>

Tell the helper that creds did not work for query. Read more

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, 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.