Struct git2::Cred

source ·
pub struct Cred { /* private fields */ }
Expand description

A structure to represent git credentials in libgit2.

Implementations§

source§

impl Cred

source

pub fn default() -> Result<Cred, Error>

Create a “default” credential usable for Negotiate mechanisms like NTLM or Kerberos authentication.

source

pub fn ssh_key_from_agent(username: &str) -> Result<Cred, Error>

Create a new ssh key credential object used for querying an ssh-agent.

The username specified is the username to authenticate.

source

pub fn ssh_key( username: &str, publickey: Option<&Path>, privatekey: &Path, passphrase: Option<&str> ) -> Result<Cred, Error>

Create a new passphrase-protected ssh key credential object.

source

pub fn ssh_key_from_memory( username: &str, publickey: Option<&str>, privatekey: &str, passphrase: Option<&str> ) -> Result<Cred, Error>

Create a new ssh key credential object reading the keys from memory.

source

pub fn userpass_plaintext(username: &str, password: &str) -> Result<Cred, Error>

Create a new plain-text username and password credential object.

source

pub fn credential_helper( config: &Config, url: &str, username: Option<&str> ) -> Result<Cred, Error>

Attempt to read credential.helper according to gitcredentials(7) 1

This function will attempt to parse the user’s credential.helper configuration, invoke the necessary processes, and read off what the username/password should be for a particular URL.

The returned credential type will be a username/password credential if successful.

source

pub fn username(username: &str) -> Result<Cred, Error>

Create a credential to specify a username.

This is used with ssh authentication to query for the username if none is specified in the URL.

source

pub fn has_username(&self) -> bool

Check whether a credential object contains username information.

source

pub fn credtype(&self) -> git_credtype_t

Return the type of credentials that this object represents.

source

pub unsafe fn unwrap(self) -> *mut git_cred

Unwrap access to the underlying raw pointer, canceling the destructor

Trait Implementations§

source§

impl Drop for Cred

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Cred

§

impl !Send for Cred

§

impl !Sync for Cred

§

impl Unpin for Cred

§

impl UnwindSafe for Cred

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

§

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

§

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.