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
impl Context
In-place mutation
Sourcepub fn destructure_url_in_place(
&mut self,
use_http_path: bool,
) -> Result<&mut Self, Error>
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
impl Context
Sourcepub fn write_to(&self, out: impl Write) -> Result<()>
pub fn write_to(&self, out: impl Write) -> Result<()>
Write ourselves to out
such that from_bytes()
can decode it losslessly.
Sourcepub fn to_bstring(&self) -> BString
pub fn to_bstring(&self) -> BString
Like write_to()
, but writes infallibly into memory.
Source§impl Context
impl Context
Sourcepub fn from_bytes(input: &[u8]) -> Result<Self, Error>
pub fn from_bytes(input: &[u8]) -> Result<Self, Error>
Decode ourselves from input
which is the format written by write_to()
.