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()
.
Trait Implementations§
source§impl From<Context> for NextAction
impl From<Context> for NextAction
source§impl TryFrom<&NextAction> for Context
impl TryFrom<&NextAction> for Context
impl Eq for Context
impl StructuralPartialEq for Context
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)