Mercurial > hg
changeset 44974: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 | 26114bd6ec60 |
children | 5965efb609b6 |
files | rust/hg-core/src/lib.rs rust/hg-core/src/operations/mod.rs |
diffstat | 2 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/lib.rs Mon Jun 15 18:26:40 2020 +0200 +++ b/rust/hg-core/src/lib.rs Fri Jun 05 08:46:35 2020 +0200 @@ -23,6 +23,7 @@ pub mod matchers; pub mod revlog; pub use revlog::*; +pub mod operations; pub mod utils; // Remove this to see (potential) non-artificial compile failures. MacOS
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rust/hg-core/src/operations/mod.rs Fri Jun 05 08:46:35 2020 +0200 @@ -0,0 +1,9 @@ +/// An interface for high-level hg operations. +/// +/// A distinction is made between operation and commands. +/// An operation is what can be done whereas a command is what is exposed by +/// the cli. A single command can use several operations to achieve its goal. +pub trait Operation<T> { + type Error; + fn run(&self) -> Result<T, Self::Error>; +}