rust: replace most "operation" structs with functions
The hg-core crate has a partially-formed concept of "operation", represented as structs with constructors and a `run` method. Each struct’s contructor takes different parameters, and each `run` has a different return type. Constructors typically don’t do much more than store parameters for `run` to access them. There was a comment about adding an `Operation` trait when the language supports expressing something so general, but it’s hard to imagine how operations with such different APIs could be used in a generic context. This commit starts removing the concept of "operation", since those are pretty much just functions. Differential Revision: https://phab.mercurial-scm.org/D9595
Showing
- rust/hg-core/src/operations/cat.rs 51 additions, 88 deletionsrust/hg-core/src/operations/cat.rs
- rust/hg-core/src/operations/debugdata.rs 21 additions, 38 deletionsrust/hg-core/src/operations/debugdata.rs
- rust/hg-core/src/operations/find_root.rs 21 additions, 40 deletionsrust/hg-core/src/operations/find_root.rs
- rust/hg-core/src/operations/list_tracked_files.rs 27 additions, 54 deletionsrust/hg-core/src/operations/list_tracked_files.rs
- rust/hg-core/src/operations/mod.rs 8 additions, 13 deletionsrust/hg-core/src/operations/mod.rs
- rust/rhg/src/commands/cat.rs 4 additions, 6 deletionsrust/rhg/src/commands/cat.rs
- rust/rhg/src/commands/debugdata.rs 5 additions, 5 deletionsrust/rhg/src/commands/debugdata.rs
- rust/rhg/src/commands/debugrequirements.rs 2 additions, 2 deletionsrust/rhg/src/commands/debugrequirements.rs
- rust/rhg/src/commands/files.rs 9 additions, 12 deletionsrust/rhg/src/commands/files.rs
- rust/rhg/src/commands/root.rs 2 additions, 2 deletionsrust/rhg/src/commands/root.rs
Loading
Please register or sign in to comment