|
@ -2,9 +2,9 @@ use std::cell::RefCell; |
|
|
use std::error::Error;
|
|
|
use std::error::Error;
|
|
|
use std::fmt;
|
|
|
use std::fmt;
|
|
|
|
|
|
|
|
|
use loggers::Logger;
|
|
|
|
|
|
use repository::SymbolRepository;
|
|
|
|
|
|
use symbols::{Symbol, SymbolRunner};
|
|
|
|
|
|
|
|
|
use crate::loggers::Logger;
|
|
|
|
|
|
use crate::repository::SymbolRepository;
|
|
|
|
|
|
use crate::symbols::{Symbol, SymbolRunner};
|
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
#[derive(Debug)]
|
|
|
pub enum SymbolRunError {
|
|
|
pub enum SymbolRunError {
|
|
@ -28,7 +28,7 @@ impl Error for SymbolRunError { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl fmt::Display for SymbolRunError {
|
|
|
impl fmt::Display for SymbolRunError {
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
|
|
|
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
match self {
|
|
|
match self {
|
|
|
SymbolRunError::Symbol(ref e) => write!(f, "{}", e),
|
|
|
SymbolRunError::Symbol(ref e) => write!(f, "{}", e),
|
|
|
SymbolRunError::ExecuteDidNotReach(_) => write!(f, "{}", self.description()),
|
|
|
SymbolRunError::ExecuteDidNotReach(_) => write!(f, "{}", self.description()),
|
|
@ -98,7 +98,7 @@ impl<L: Logger> SymbolRunner for DrySymbolRunner<L> { |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
pub struct ReportingSymbolRunner<'a, R: 'a + SymbolRunner, L: Logger>(&'a R, RefCell<L>);
|
|
|
|
|
|
|
|
|
pub struct ReportingSymbolRunner<'a, R: SymbolRunner, L: Logger>(&'a R, RefCell<L>);
|
|
|
|
|
|
|
|
|
impl<'a, R, L> ReportingSymbolRunner<'a, R, L>
|
|
|
impl<'a, R, L> ReportingSymbolRunner<'a, R, L>
|
|
|
where
|
|
|
where
|
|
@ -131,7 +131,7 @@ where |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
use resources::Resource;
|
|
|
|
|
|
|
|
|
use crate::resources::Resource;
|
|
|
use std::collections::HashSet;
|
|
|
use std::collections::HashSet;
|
|
|
|
|
|
|
|
|
pub struct NonRepeatingSymbolRunner<R: SymbolRunner> {
|
|
|
pub struct NonRepeatingSymbolRunner<R: SymbolRunner> {
|
|
@ -171,12 +171,11 @@ impl<R: SymbolRunner> SymbolRunner for NonRepeatingSymbolRunner<R> { |
|
|
}
|
|
|
}
|
|
|
use std::marker::PhantomData;
|
|
|
use std::marker::PhantomData;
|
|
|
|
|
|
|
|
|
pub struct RequirementsResolvingSymbolRunner<
|
|
|
|
|
|
'a,
|
|
|
|
|
|
's,
|
|
|
|
|
|
R: 'a + SymbolRunner,
|
|
|
|
|
|
G: 'a + SymbolRepository<'s>,
|
|
|
|
|
|
>(R, &'a G, PhantomData<Box<dyn Symbol + 's>>);
|
|
|
|
|
|
|
|
|
pub struct RequirementsResolvingSymbolRunner<'a, 's, R: 'a + SymbolRunner, G: SymbolRepository<'s>>(
|
|
|
|
|
|
R,
|
|
|
|
|
|
&'a G,
|
|
|
|
|
|
PhantomData<Box<dyn Symbol + 's>>,
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
impl<'s, 'a: 's, R, G> RequirementsResolvingSymbolRunner<'a, 's, R, G>
|
|
|
impl<'s, 'a: 's, R, G> RequirementsResolvingSymbolRunner<'a, 's, R, G>
|
|
|
where
|
|
|
where
|
|
@ -211,10 +210,10 @@ mod test { |
|
|
use std::error::Error;
|
|
|
use std::error::Error;
|
|
|
use std::fmt;
|
|
|
use std::fmt;
|
|
|
|
|
|
|
|
|
use loggers::Logger;
|
|
|
|
|
|
use schema::InitializingSymbolRunner;
|
|
|
|
|
|
use schema::SymbolRunner;
|
|
|
|
|
|
use symbols::{Action, OwnedSymbolAction, Symbol, SymbolAction};
|
|
|
|
|
|
|
|
|
use crate::loggers::Logger;
|
|
|
|
|
|
use crate::schema::InitializingSymbolRunner;
|
|
|
|
|
|
use crate::schema::SymbolRunner;
|
|
|
|
|
|
use crate::symbols::{Action, OwnedSymbolAction, Symbol, SymbolAction};
|
|
|
|
|
|
|
|
|
#[derive(Debug, PartialEq, Clone)]
|
|
|
#[derive(Debug, PartialEq, Clone)]
|
|
|
enum DummySymbolError {
|
|
|
enum DummySymbolError {
|
|
@ -228,7 +227,7 @@ mod test { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl fmt::Display for DummySymbolError {
|
|
|
impl fmt::Display for DummySymbolError {
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
|
|
|
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
write!(f, "Dummy symbol error")
|
|
|
write!(f, "Dummy symbol error")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -259,7 +258,7 @@ mod test { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl<'a> fmt::Display for DummySymbol<'a> {
|
|
|
impl<'a> fmt::Display for DummySymbol<'a> {
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
|
|
|
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
write!(f, "Dummy symbol")
|
|
|
write!(f, "Dummy symbol")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|