mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-19 19:08:08 +00:00
cleanup: leverage BoxStream
/BoxFuture
type aliases
Thanks to @fowles for bringing these to my attention.
This commit is contained in:
parent
e2138ca2df
commit
8d67b1412e
2 changed files with 11 additions and 13 deletions
|
@ -71,7 +71,7 @@ pub struct CopyRecordOpts {
|
|||
// TODO: Probably something for git similarity detection
|
||||
}
|
||||
|
||||
pub type CopyRecordStream = Pin<Box<dyn Stream<Item = BackendResult<CopyRecord>>>>;
|
||||
pub type CopyRecordStream = BoxStream<BackendResult<CopyRecord>>;
|
||||
|
||||
pub trait Backend {
|
||||
/// Get all copy records for `paths` in the dag range `roots..heads`.
|
||||
|
|
|
@ -22,8 +22,9 @@ use std::sync::Arc;
|
|||
use std::task::{Context, Poll};
|
||||
use std::{iter, vec};
|
||||
|
||||
use futures::stream::StreamExt;
|
||||
use futures::{Future, Stream, TryStreamExt};
|
||||
use futures::future::BoxFuture;
|
||||
use futures::stream::{BoxStream, StreamExt};
|
||||
use futures::{Stream, TryStreamExt};
|
||||
use itertools::Itertools;
|
||||
|
||||
use crate::backend;
|
||||
|
@ -407,15 +408,12 @@ impl MergedTree {
|
|||
/// Type alias for the result from `MergedTree::diff_stream()`. We use a
|
||||
/// `Stream` instead of an `Iterator` so high-latency backends (e.g. cloud-based
|
||||
/// ones) can fetch trees asynchronously.
|
||||
pub type TreeDiffStream<'matcher> = Pin<
|
||||
Box<
|
||||
dyn Stream<
|
||||
Item = (
|
||||
RepoPathBuf,
|
||||
BackendResult<(MergedTreeValue, MergedTreeValue)>,
|
||||
),
|
||||
> + 'matcher,
|
||||
>,
|
||||
pub type TreeDiffStream<'matcher> = BoxStream<
|
||||
'matcher,
|
||||
(
|
||||
RepoPathBuf,
|
||||
BackendResult<(MergedTreeValue, MergedTreeValue)>,
|
||||
),
|
||||
>;
|
||||
|
||||
fn all_tree_basenames(trees: &Merge<Tree>) -> impl Iterator<Item = &RepoPathComponent> {
|
||||
|
@ -902,7 +900,7 @@ pub struct TreeDiffStreamImpl<'matcher> {
|
|||
#[allow(clippy::type_complexity)]
|
||||
pending_trees: VecDeque<(
|
||||
RepoPathBuf,
|
||||
Pin<Box<dyn Future<Output = BackendResult<(MergedTree, MergedTree)>> + 'matcher>>,
|
||||
BoxFuture<'matcher, BackendResult<(MergedTree, MergedTree)>>,
|
||||
)>,
|
||||
/// The maximum number of trees to request concurrently. However, we do the
|
||||
/// accounting per path, so for there will often be twice as many pending
|
||||
|
|
Loading…
Reference in a new issue