diff rust/hg-core/src/lib.rs @ 40950:18513d6ef7d4

rust: changed Graph.parents to return [Revision; 2] This will allow for simple iteration on parent revisions, such as: for parent in graph.parents(rev)?.iter().cloned() This seems to be a zero overhead abstraction once built in release mode. Differential Revision: https://phab.mercurial-scm.org/D5415
author Georges Racinet <gracinet@anybox.fr>
date Fri, 30 Nov 2018 00:44:04 +0100
parents dbc28c91f7ff
children d097dd0afc19
line wrap: on
line diff
--- a/rust/hg-core/src/lib.rs	Tue Dec 11 17:31:54 2018 +0100
+++ b/rust/hg-core/src/lib.rs	Fri Nov 30 00:44:04 2018 +0100
@@ -15,7 +15,7 @@
 
 /// The simplest expression of what we need of Mercurial DAGs.
 pub trait Graph {
-    fn parents(&self, Revision) -> Result<(Revision, Revision), GraphError>;
+    fn parents(&self, Revision) -> Result<[Revision; 2], GraphError>;
 }
 
 #[derive(Clone, Debug, PartialEq)]