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

Method execute

behavioral/command/command/cut.rs:12–22  ·  view source on GitHub ↗
(&mut self, app: &mut Cursive)

Source from the content-addressed store, hash-verified

10
11impl Command for CutCommand {
12 fn execute(&mut self, app: &mut Cursive) -> bool {
13 let mut editor = app.find_name::<EditView>("Editor").unwrap();
14
15 app.with_user_data(|context: &mut AppContext| {
16 self.backup = editor.get_content().to_string();
17 context.clipboard = self.backup.clone();
18 editor.set_content("".to_string());
19 });
20
21 true
22 }
23
24 fn undo(&mut self, app: &mut Cursive) {
25 let mut editor = app.find_name::<EditView>("Editor").unwrap();

Callers 1

executeFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected