Update generate templating
This commit is contained in:
parent
3663521596
commit
5ba70c1e52
1 changed files with 6 additions and 16 deletions
|
@ -29,25 +29,21 @@ pub trait GeneratedTask {
|
||||||
/// The name of this generator type. e.g. "mail", mutable
|
/// The name of this generator type. e.g. "mail", mutable
|
||||||
fn gen_name_mut(&mut self) -> Option<&mut String>;
|
fn gen_name_mut(&mut self) -> Option<&mut String>;
|
||||||
/// Set the name of this generator type. e.g. "mail"
|
/// Set the name of this generator type. e.g. "mail"
|
||||||
fn set_gen_name<T>(&mut self, new: Option<T>)
|
fn set_gen_name(&mut self, new: Option<impl Into<String>>);
|
||||||
where
|
|
||||||
T: Into<String>;
|
|
||||||
/// The id of the generator type, which should be unique for all generator Tasks with the same
|
/// The id of the generator type, which should be unique for all generator Tasks with the same
|
||||||
/// name
|
/// name
|
||||||
fn gen_id(&self) -> Option<&String>;
|
fn gen_id(&self) -> Option<&String>;
|
||||||
/// The generator id, mutable
|
/// The generator id, mutable
|
||||||
fn gen_id_mut(&mut self) -> Option<&mut String>;
|
fn gen_id_mut(&mut self) -> Option<&mut String>;
|
||||||
/// Set the generator id
|
/// Set the generator id
|
||||||
fn set_gen_id<T>(&mut self, new: Option<T>)
|
fn set_gen_id(&mut self, new: Option<impl Into<String>>);
|
||||||
where
|
|
||||||
T: Into<String>;
|
|
||||||
/// What should happen with the task, when the generator is missing.
|
/// What should happen with the task, when the generator is missing.
|
||||||
/// This is relevant, when the generate method is called with one or more tasks with a
|
/// This is relevant, when the generate method is called with one or more tasks with a
|
||||||
/// generator name set, all existing tasks with that generator name will be dealt with
|
/// generator name set, all existing tasks with that generator name will be dealt with
|
||||||
/// according to this field.
|
/// according to this field.
|
||||||
fn gen_orphan(&self) -> OrphanBehavior;
|
fn gen_orphan(&self) -> OrphanBehavior;
|
||||||
/// Set the OrphanBehavior
|
/// Set the OrphanBehavior
|
||||||
fn set_gen_orphan<T>(&mut self, new: OrphanBehavior);
|
fn set_gen_orphan(&mut self, new: OrphanBehavior);
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
|
@ -90,10 +86,7 @@ impl GeneratedTask for Task {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_gen_name<T>(&mut self, new: Option<T>)
|
fn set_gen_name(&mut self, new: Option<impl Into<String>>) {
|
||||||
where
|
|
||||||
T: Into<String>,
|
|
||||||
{
|
|
||||||
if let Some(new) = new {
|
if let Some(new) = new {
|
||||||
self.uda_mut().insert(GEN_NAME.into(), U::Str(new.into()));
|
self.uda_mut().insert(GEN_NAME.into(), U::Str(new.into()));
|
||||||
} else {
|
} else {
|
||||||
|
@ -121,10 +114,7 @@ impl GeneratedTask for Task {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_gen_id<T>(&mut self, new: Option<T>)
|
fn set_gen_id(&mut self, new: Option<impl Into<String>>) {
|
||||||
where
|
|
||||||
T: Into<String>,
|
|
||||||
{
|
|
||||||
if let Some(new) = new {
|
if let Some(new) = new {
|
||||||
self.uda_mut().insert(GEN_ID.into(), U::Str(new.into()));
|
self.uda_mut().insert(GEN_ID.into(), U::Str(new.into()));
|
||||||
} else {
|
} else {
|
||||||
|
@ -143,7 +133,7 @@ impl GeneratedTask for Task {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_gen_orphan<T>(&mut self, new: OrphanBehavior) {
|
fn set_gen_orphan(&mut self, new: OrphanBehavior) {
|
||||||
match new {
|
match new {
|
||||||
O::DeleteOrphan => self.uda_mut().insert(GEN_ORPHAN.into(), DELETE.clone()),
|
O::DeleteOrphan => self.uda_mut().insert(GEN_ORPHAN.into(), DELETE.clone()),
|
||||||
O::CompleteOrphan => self.uda_mut().insert(GEN_ORPHAN.into(), COMPLETE.clone()),
|
O::CompleteOrphan => self.uda_mut().insert(GEN_ORPHAN.into(), COMPLETE.clone()),
|
||||||
|
|
Loading…
Reference in a new issue