revset: implement Debug for RevsetImpl and add trait bound accordingly

This commit is contained in:
Yuya Nishihara 2023-04-02 18:13:51 +09:00
parent 2aab6c7825
commit 429562ca2f
2 changed files with 9 additions and 1 deletions

View file

@ -71,6 +71,14 @@ impl<'index> RevsetImpl<'index> {
}
}
impl fmt::Debug for RevsetImpl<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RevsetImpl")
.field("inner", &self.inner)
.finish_non_exhaustive()
}
}
impl<'index> Revset<'index> for RevsetImpl<'index> {
fn iter(&self) -> Box<dyn Iterator<Item = CommitId> + '_> {
Box::new(self.inner.iter().map(|index_entry| index_entry.commit_id()))

View file

@ -1654,7 +1654,7 @@ pub fn resolve_symbols(
)
}
pub trait Revset<'index> {
pub trait Revset<'index>: fmt::Debug {
/// Iterate in topological order with children before parents.
fn iter(&self) -> Box<dyn Iterator<Item = CommitId> + '_>;