Define 'apply_parameter' method on 'Project'
This commit is contained in:
@@ -53,7 +53,10 @@ impl Blueprint<Schema> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Blueprint<T> {
|
||||
impl<T> Blueprint<T>
|
||||
where
|
||||
T: Clone,
|
||||
{
|
||||
pub fn lookup(
|
||||
&self,
|
||||
title: Option<&String>,
|
||||
@@ -83,10 +86,10 @@ impl<T> Blueprint<T> {
|
||||
action: F,
|
||||
) -> Result<A, E>
|
||||
where
|
||||
F: Fn(&Validator<T>) -> Result<A, E>,
|
||||
F: Fn(Validator<T>) -> Result<A, E>,
|
||||
{
|
||||
match self.lookup(title, purpose) {
|
||||
Some(LookupResult::One(validator)) => action(validator),
|
||||
Some(LookupResult::One(validator)) => action(validator.to_owned()),
|
||||
Some(LookupResult::Many) => Err(when_too_many(
|
||||
self.validators
|
||||
.iter()
|
||||
|
||||
@@ -122,7 +122,12 @@ impl Validator<Schema> {
|
||||
.unwrap(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Validator<T>
|
||||
where
|
||||
T: Clone,
|
||||
{
|
||||
pub fn apply(&mut self, arg: &Term<DeBruijn>) -> Result<(), Error> {
|
||||
match self.parameters.split_first() {
|
||||
None => Err(Error::NoParametersToApply),
|
||||
|
||||
Reference in New Issue
Block a user