History

[async-client] prepare for unblocking the protocol delegate

Sebastian Thiel committed 5 years ago

Commit 796c7d51 parent 0d5b9117 files · +20 −17Browse files

Showing the changes to git-protocol/src/fetch/function.rs (1 of 7 files). Show all

Unified · Split

git-protocol/src/fetch/function.rs+6−5
@@ -19,14 +19,15 @@ use std::io; · 18 unmodified lines
19///19///
20/// _Note_ that depending on the `delegate`, the actual action performed can be `ls-refs`, `clone` or `fetch`.20/// _Note_ that depending on the `delegate`, the actual action performed can be `ls-refs`, `clone` or `fetch`.
21#[maybe_async]21#[maybe_async]
22pub async fn fetch<F>(22pub async fn fetch<F, D>(
23 mut transport: impl client::Transport,23 mut transport: impl client::Transport,
24 delegate: &mut impl Delegate,24 mut delegate: D,
25 mut authenticate: F,25 mut authenticate: F,
26 mut progress: impl Progress,26 mut progress: impl Progress,
27) -> Result<(), Error>27) -> Result<D, Error>
28where28where
29 F: FnMut(credentials::Action<'_>) -> credentials::Result,29 F: FnMut(credentials::Action<'_>) -> credentials::Result,
30 D: Delegate + Send + 'static,
30{31{
31 let (protocol_version, mut parsed_refs, capabilities, call_ls_refs) = {32 let (protocol_version, mut parsed_refs, capabilities, call_ls_refs) = {
32 progress.init(None, progress::steps());33 progress.init(None, progress::steps());
@@ -134,7 +135,7 @@ where · 101 unmodified lines
134 135
135 if next == Action::Close {136 if next == Action::Close {
136 transport.close().await?;137 transport.close().await?;
137 return Ok(());138 return Ok(delegate);
138 }139 }
139 140
140 Response::check_required_features(protocol_version, &fetch_features)?;141 Response::check_required_features(protocol_version, &fetch_features)?;
@@ -167,7 +168,7 @@ where · 26 unmodified lines
167 }168 }
168 }169 }
169 }170 }
170 Ok(())171 Ok(delegate)
171}172}
172 173
173fn setup_remote_progress(174fn setup_remote_progress(