pub struct RemoteCallbacks<'a> { /* private fields */ }
Expand description

A structure to contain the callbacks which are invoked when a repository is being updated or downloaded.

These callbacks are used to manage facilities such as authentication, transfer progress, etc.

Implementations

Creates a new set of empty callbacks

The callback through which to fetch credentials if required.

Example

Prepare a callback to authenticate using the $HOME/.ssh/id_rsa SSH key, and extracting the username from the URL (i.e. git@github.com:rust-lang/git2-rs.git):

use git2::{Cred, RemoteCallbacks};
use std::env;

let mut callbacks = RemoteCallbacks::new();
callbacks.credentials(|_url, username_from_url, _allowed_types| {
  Cred::ssh_key(
    username_from_url.unwrap(),
    None,
    std::path::Path::new(&format!("{}/.ssh/id_rsa", env::var("HOME").unwrap())),
    None,
  )
});

The callback through which progress is monitored.

Textual progress from the remote.

Text sent over the progress side-band will be passed to this function (this is the ‘counting objects’ output).

Each time a reference is updated locally, the callback will be called with information about it.

If certificate verification fails, then this callback will be invoked to let the caller make the final decision of whether to allow the connection to proceed.

Set a callback to get invoked for each updated reference on a push.

The first argument to the callback is the name of the reference and the second is a status message sent by the server. If the status is Some then the push was rejected.

The callback through which progress of push transfer is monitored

Function to call with progress information during pack building. Be aware that this is called inline with pack building operations, so performance may be affected.

Trait Implementations

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.