MCPcopy Create free account
hub / github.com/fadeevab/design-patterns-rust / execute

Function execute

behavioral/command/main.rs:37–43  ·  view source on GitHub ↗

Executes a command and then pushes it to a history array.

(app: &mut Cursive, mut command: impl Command + 'static)

Source from the content-addressed store, hash-verified

35
36/// Executes a command and then pushes it to a history array.
37fn execute(app: &mut Cursive, mut command: impl Command + 'static) {
38 if command.execute(app) {
39 app.with_user_data(|context: &mut AppContext| {
40 context.history.push(Box::new(command));
41 });
42 }
43}
44
45/// Pops the last command and executes an undo action.
46fn undo(app: &mut Cursive) {

Callers 1

mainFunction · 0.70

Calls 1

executeMethod · 0.45

Tested by

no test coverage detected