gix_credentials::protocol

Struct Context

Source
pub struct Context {
    pub protocol: Option<String>,
    pub host: Option<String>,
    pub path: Option<BString>,
    pub username: Option<String>,
    pub password: Option<String>,
    pub url: Option<BString>,
    pub quit: Option<bool>,
}
Expand description

Additional context to be passed to the credentials helper.

Fields§

§protocol: Option<String>

The protocol over which the credential will be used (e.g., https).

§host: Option<String>

The remote hostname for a network credential. This includes the port number if one was specified (e.g., “example.com:8088”).

§path: Option<BString>

The path with which the credential will be used. E.g., for accessing a remote https repository, this will be the repository’s path on the server. It can also be a path on the file system.

§username: Option<String>

The credential’s username, if we already have one (e.g., from a URL, the configuration, the user, or from a previously run helper).

§password: Option<String>

The credential’s password, if we are asking it to be stored.

§url: Option<BString>

When this special attribute is read by git credential, the value is parsed as a URL and treated as if its constituent parts were read (e.g., url=https://example.com would behave as if protocol=https and host=example.com had been provided). This can help callers avoid parsing URLs themselves.

§quit: Option<bool>

If true, the caller should stop asking for credentials immediately without calling more credential helpers in the chain.

Implementations§

Source§

impl Context

Source

pub fn to_url(&self) -> Option<BString>

Convert all relevant fields into a URL for consumption.

Source

pub fn to_prompt(&self, field: &str) -> String

Compute a prompt to obtain the given value.

Source§

impl Context

In-place mutation

Source

pub fn destructure_url_in_place( &mut self, use_http_path: bool, ) -> Result<&mut Self, Error>

Destructure the url at our url field into parts like protocol, host, username and path and store them in our respective fields. If use_http_path is set, http paths are significant even though normally this isn’t the case.

Source§

impl Context

Source

pub fn write_to(&self, out: impl Write) -> Result<()>

Write ourselves to out such that from_bytes() can decode it losslessly.

Source

pub fn to_bstring(&self) -> BString

Like write_to(), but writes infallibly into memory.

Source§

impl Context

Source

pub fn from_bytes(input: &[u8]) -> Result<Self, Error>

Decode ourselves from input which is the format written by write_to().

Trait Implementations§

Source§

impl Clone for Context

Source§

fn clone(&self) -> Context

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Context

Source§

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

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

impl Default for Context

Source§

fn default() -> Context

Returns the “default value” for a type. Read more
Source§

impl From<Context> for NextAction

Source§

fn from(ctx: Context) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Context

Source§

fn eq(&self, other: &Context) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<&NextAction> for Context

Source§

type Error = Error

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

fn try_from(value: &NextAction) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Eq for Context

Source§

impl StructuralPartialEq for Context

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T