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
1919 ///
2020 /// _Note_ that depending on the `delegate`, the actual action performed can be `ls-refs`, `clone` or `fetch`.
2121 #[maybe_async]
22−pub async fn fetch<F>(
22+pub async fn fetch<F, D>(
2323 mut transport: impl client::Transport,
24− delegate: &mut impl Delegate,
24+ mut delegate: D,
2525 mut authenticate: F,
2626 mut progress: impl Progress,
27−) -> Result<(), Error>
27+) -> Result<D, Error>
2828 where
2929 F: FnMut(credentials::Action<'_>) -> credentials::Result,
30+ D: Delegate + Send + 'static,
3031 {
3132 let (protocol_version, mut parsed_refs, capabilities, call_ls_refs) = {
3233 progress.init(None, progress::steps());
@@ -134,7 +135,7 @@ where · 101 unmodified lines
134135
135136 if next == Action::Close {
136137 transport.close().await?;
137− return Ok(());
138+ return Ok(delegate);
138139 }
139140
140141 Response::check_required_features(protocol_version, &fetch_features)?;
@@ -167,7 +168,7 @@ where · 26 unmodified lines
167168 }
168169 }
169170 }
170− Ok(())
171+ Ok(delegate)
171172 }
172173
173174 fn setup_remote_progress(