gix_protocol/
lib.rs

1//! An abstraction over [fetching][fetch()] a pack from the server.
2//!
3//! Generally, there is the following order of operations.
4//!
5//! * create a [`Transport`](gix_transport::client::Transport)
6//! * perform a [`handshake()`]
7//! * execute a [`Command`]
8//!     - [list references](ls_refs())
9//!          - create a mapping between [refspecs and references](fetch::RefMap)
10//!     - [receive a pack](fetch())
11//!
12//! ## Feature Flags
13#![cfg_attr(
14    all(doc, feature = "document-features"),
15    doc = ::document_features::document_features!()
16)]
17#![cfg_attr(all(doc, feature = "document-features"), feature(doc_cfg, doc_auto_cfg))]
18#![deny(missing_docs, rust_2018_idioms, unsafe_code)]
19
20/// A function that performs a given credential action, trying to obtain credentials for an operation that needs it.
21///
22/// Useful for both `fetch` and `push`.
23#[cfg(feature = "handshake")]
24pub type AuthenticateFn<'a> = Box<dyn FnMut(gix_credentials::helper::Action) -> gix_credentials::protocol::Result + 'a>;
25
26/// A selector for V2 commands to invoke on the server for purpose of pre-invocation validation.
27#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
28pub enum Command {
29    /// List references.
30    LsRefs,
31    /// Fetch a pack.
32    Fetch,
33}
34pub mod command;
35
36#[cfg(feature = "async-client")]
37pub use async_trait;
38#[cfg(feature = "async-client")]
39pub use futures_io;
40#[cfg(feature = "async-client")]
41pub use futures_lite;
42#[cfg(feature = "handshake")]
43pub use gix_credentials as credentials;
44/// A convenience export allowing users of gix-protocol to use the transport layer without their own cargo dependency.
45pub use gix_transport as transport;
46pub use maybe_async;
47
48///
49pub mod fetch;
50#[cfg(any(feature = "blocking-client", feature = "async-client"))]
51pub use fetch::function::fetch;
52
53mod remote_progress;
54pub use remote_progress::RemoteProgress;
55
56#[cfg(all(feature = "blocking-client", feature = "async-client"))]
57compile_error!("Cannot set both 'blocking-client' and 'async-client' features as they are mutually exclusive");
58
59///
60pub mod handshake;
61#[cfg(any(feature = "blocking-client", feature = "async-client"))]
62#[cfg(feature = "handshake")]
63pub use handshake::function::handshake;
64
65///
66pub mod ls_refs;
67#[cfg(any(feature = "blocking-client", feature = "async-client"))]
68pub use ls_refs::function::ls_refs;
69
70mod util;
71pub use util::*;