annotate rust/hg-core/src/operations/mod.rs @ 45000:5965efb609b6

hg-core: add FindRoot operation to find repository root path Differential Revision: https://phab.mercurial-scm.org/D8609
author Antoine Cezar <antoine.cezar@octobus.net>
date Fri, 05 Jun 2020 08:48:09 +0200
parents a46e36b82461
children 98817e5daca7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45000
5965efb609b6 hg-core: add FindRoot operation to find repository root path
Antoine Cezar <antoine.cezar@octobus.net>
parents: 44999
diff changeset
1 mod find_root;
5965efb609b6 hg-core: add FindRoot operation to find repository root path
Antoine Cezar <antoine.cezar@octobus.net>
parents: 44999
diff changeset
2 pub use find_root::{FindRoot, FindRootError, FindRootErrorKind};
5965efb609b6 hg-core: add FindRoot operation to find repository root path
Antoine Cezar <antoine.cezar@octobus.net>
parents: 44999
diff changeset
3
44999
a46e36b82461 hg-core: add Operation interface for high-level hg operations
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
4 /// An interface for high-level hg operations.
a46e36b82461 hg-core: add Operation interface for high-level hg operations
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
5 ///
a46e36b82461 hg-core: add Operation interface for high-level hg operations
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
6 /// A distinction is made between operation and commands.
a46e36b82461 hg-core: add Operation interface for high-level hg operations
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
7 /// An operation is what can be done whereas a command is what is exposed by
a46e36b82461 hg-core: add Operation interface for high-level hg operations
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
8 /// the cli. A single command can use several operations to achieve its goal.
a46e36b82461 hg-core: add Operation interface for high-level hg operations
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
9 pub trait Operation<T> {
a46e36b82461 hg-core: add Operation interface for high-level hg operations
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
10 type Error;
a46e36b82461 hg-core: add Operation interface for high-level hg operations
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
11 fn run(&self) -> Result<T, Self::Error>;
a46e36b82461 hg-core: add Operation interface for high-level hg operations
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
12 }