assemble_core/task/
create_task.rs1use crate::__export::{ProjectResult, TaskId};
2use crate::task::flags::{OptionDeclarations, OptionsDecoder};
3use crate::{Project, Task};
4
5pub trait CreateTask: Sized {
7 fn new(using_id: &TaskId, project: &Project) -> ProjectResult<Self>;
9
10 fn description() -> String {
12 String::new()
13 }
14
15 #[doc(hidden)]
17 fn only_in_current() -> bool {
18 false
19 }
20
21 fn options_declarations() -> Option<OptionDeclarations> {
25 None
26 }
27
28 fn try_set_from_decoder(&mut self, _decoder: &OptionsDecoder) -> ProjectResult<()> {
32 Ok(())
33 }
34}
35
36impl<T: Default + Task> CreateTask for T {
37 fn new(_: &TaskId, _: &Project) -> ProjectResult<Self> {
38 Ok(T::default())
39 }
40}