82 lines · 2.8 KB · Rust
RawDownload
//! An abstraction over [fetching][fetch()] a pack from the server.//!//! Generally, there is the following order of operations.//!//! * create a `Transport`, either blocking or async//! * perform a [`handshake()`]//! * execute a [`Command`]//!     - [list references](LsRefsCommand)//!          - create a mapping between [refspecs and references](fetch::RefMap)//!     - [receive a pack](fetch())//!//! ## Feature Flags#![cfg_attr(    all(doc, feature = "document-features"),    doc = ::document_features::document_features!())]#![cfg_attr(all(doc, feature = "document-features"), feature(doc_cfg))]#![deny(missing_docs, unsafe_code)] /// A function that performs a given credential action, trying to obtain credentials for an operation that needs it.////// Useful for both `fetch` and `push`.#[cfg(feature = "handshake")]pub type AuthenticateFn<'a> = Box<dyn FnMut(gix_credentials::helper::Action) -> gix_credentials::protocol::Result + 'a>; /// A selector for V2 commands to invoke on the server for purpose of pre-invocation validation.#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]pub enum Command {    /// List references.    LsRefs,    /// Fetch a pack.    Fetch,}pub mod command; /// Attribute macros and mode flags for sharing async-shaped implementations between client modes.#[cfg(any(feature = "blocking-client", feature = "async-client"))]pub mod bisync {    #[cfg(all(feature = "async-client", not(feature = "blocking-client")))]    pub use gix_macros::{discard as only_sync, keep as bisync, keep as only_async};    #[cfg(feature = "blocking-client")]    pub use gix_macros::{discard as only_async, keep as only_sync, sync as bisync};     /// Whether the blocking implementation is selected.    pub const SYNC: bool = cfg!(feature = "blocking-client");    /// Whether the async implementation is selected.    pub const ASYNC: bool = !SYNC;}#[cfg(feature = "async-client")]pub use async_trait;#[cfg(feature = "async-client")]pub use futures_io;#[cfg(feature = "async-client")]pub use futures_lite;#[cfg(feature = "handshake")]pub use gix_credentials as credentials;/// A convenience export allowing users of gix-protocol to use the transport layer without their own cargo dependency.pub use gix_transport as transport; ///pub mod fetch;#[cfg(any(feature = "blocking-client", feature = "async-client"))]pub use fetch::function::fetch; mod remote_progress;pub use remote_progress::RemoteProgress; ///pub mod handshake;#[cfg(any(feature = "blocking-client", feature = "async-client"))]#[cfg(feature = "handshake")]pub use handshake::function::handshake;#[cfg(feature = "handshake")]pub use handshake::hero::Handshake; ///pub mod ls_refs;#[cfg(any(feature = "blocking-client", feature = "async-client"))]pub use ls_refs::function::LsRefsCommand; mod util;pub use util::*;