annotate rust/hg-core/src/operations/mod.rs @ 44999:a46e36b82461

hg-core: add Operation interface for high-level hg operations A distinction is made between operations and commands. An operation is a high-level function of mercurial whereas a command is what is exposed by the cli. A single command can use several operations to achieve its goal. Differential Revision: https://phab.mercurial-scm.org/D8608
author Antoine Cezar <antoine.cezar@octobus.net>
date Fri, 05 Jun 2020 08:46:35 +0200
parents
children 5965efb609b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
44999
a46e36b82461 hg-core: add Operation interface for high-level hg operations
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
1 /// 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
2 ///
a46e36b82461 hg-core: add Operation interface for high-level hg operations
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
3 /// 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
4 /// 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
5 /// 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
6 pub trait Operation<T> {
a46e36b82461 hg-core: add Operation interface for high-level hg operations
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
7 type Error;
a46e36b82461 hg-core: add Operation interface for high-level hg operations
Antoine Cezar <antoine.cezar@octobus.net>
parents:
diff changeset
8 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
9 }