diff --git a/src/dsl.rs b/src/dsl.rs
index 3ba104f..750d238 100644
--- a/src/dsl.rs
+++ b/src/dsl.rs
@@ -1,88 +1,95 @@
-pub trait IntegerHandler: Sized {
- fn handleFixedInteger(&self, dst: &mut S, value: u64, isNegative: bool);
-}
-
-pub trait FloatHandler: Sized {
- fn handleFloat(&self, dst: &mut S, value: f64);
-}
-
-pub trait BooleanHandler: Sized {
- fn handleBoolean(&self, dst: &mut S, value: bool);
-}
-
-pub trait NullHandler: Sized {
- fn handleNull(&self, dst: &mut S);
-}
-
-pub trait NoValueHandler: Sized {
- fn handleNoValue(&self, dst: &mut S);
-}
-
-pub trait ObjectHandler
: Sized {
- fn produceObject(&self) -> S;
- fn storeObject(&self, dst: &mut P, value: S);
-}
-
-pub trait StringHandler
: Sized {
- fn handleString(&self, dst: &mut P, value: T);
-}
-
-pub trait ObjectConfigurationScope {
- type K;
-
- fn ignoreKey_required(&mut self, name: &Self::K);
- fn ignoreKey_optional(&mut self, name: &Self::K);
- fn processKey(&mut self, name: &Self::K, config: impl ValueConfiguration);
- fn processKey_optional(
- &mut self,
- name: &Self::K,
- config: impl ValueConfiguration,
- fallback: impl NoValueHandler,
+pub trait IntegerHandler: Sized {
+ fn handleFixedInteger(
+ &self,
+ runtime: &mut Runtime,
+ dst: &mut Container,
+ value: u64,
+ isNegative: bool,
);
}
-pub trait ObjectConfiguration: Sized {
- type S: Sized;
+
+pub trait FloatHandler: Sized {
+ fn handleFloat(&self, runtime: &mut Runtime, dst: &mut Container, value: f64);
+}
+
+pub trait BooleanHandler: Sized {
+ fn handleBoolean(&self, runtime: &mut Runtime, dst: &mut Container, value: bool);
+}
+
+pub trait NullHandler: Sized {
+ fn handleNull(&self, runtime: &mut Runtime, dst: &mut Container);
+}
+
+pub trait NoValueHandler: Sized {
+ fn handleNoValue(&self, runtime: &mut Runtime, dst: &mut Container);
+}
+
+pub trait StringHandler: Sized {
+ fn handleString(&self, runtime: &mut Runtime, dst: &mut Container, value: String);
+}
+
+pub trait ObjectHandler: Sized {
+ fn produceObject(&self, runtime: &mut Runtime) -> ObjectBuilder;
+ fn storeObject(&self, runtime: &mut Runtime, dst: &mut ParentContainer, value: ObjectBuilder);
+}
+
+pub trait ArrayHandler: Sized {
+ fn produceArray(&self, runtime: &mut Runtime) -> ArrayBuilder;
+ fn storeArray(&self, runtime: &mut Runtime, dst: &mut ParentContainer, value: ArrayBuilder);
+}
+
+pub trait ObjectConfiguration: Sized {
+ type ObjectBuilder: Sized;
fn configureObject(
&self,
- scope: &impl ArrayConfigurationScope,
- ) -> impl ObjectHandler;
+ scope: &impl ObjectConfigurationScope,
+ ) -> impl ObjectHandler;
}
-pub trait ArrayHandler: Sized {
- fn produceArray(&self) -> S;
- fn storeArray(&self, dst: &mut P, value: S);
+pub trait ArrayConfiguration: Sized {
+ type ArrayBuilder: Sized;
+ fn configureArray(
+ &self,
+ scope: &impl ArrayConfigurationScope,
+ ) -> impl ObjectHandler;
}
-pub trait ArrayConfigurationScope {
+pub trait ObjectConfigurationScope {
+ type Key: Sized;
+
+ fn ignoreKey_required(&mut self, name: Self::Key);
+ fn ignoreKey_optional(&mut self, name: Self::Key);
+ fn processKey(&mut self, name: Self::Key, config: impl ValueConfiguration);
+ fn processKey_optional(
+ &mut self,
+ name: Self::Key,
+ config: impl ValueConfiguration,
+ fallback: impl NoValueHandler,
+ );
+}
+pub trait ArrayConfigurationScope {
fn ignoreElements_required(&self, start: usize, endInclusive: Option);
fn ignoreElements_optional(&self, start: usize, endInclusive: Option);
fn processElements_required(
&self,
start: usize,
endInclusive: Option,
- config: impl ValueConfiguration,
+ config: impl ValueConfiguration,
);
fn processElements_optional(
&self,
start: usize,
endInclusive: Option,
- config: impl ValueConfiguration,
+ config: impl ValueConfiguration
);
}
-pub trait ArrayConfiguration: Sized {
- type S: Sized;
- fn configureArray(
- &self,
- scope: &impl ArrayConfigurationScope,
- ) -> impl ObjectHandler;
-}
-
-pub trait ValueConfiguration
: Sized {
- fn integerHandler(&self) -> Option>;
- fn floatHandler(&self) -> Option>;
- fn booleanHandler(&self) -> Option>;
- fn nullHandler(&self) -> Option>;
- fn arrayHandler(&self) -> Option>;
- fn objectHandler(&self) -> Option>;
+pub trait ValueConfiguration: Sized {
+ fn integerHandler(&self) -> Option>;
+ fn floatHandler(&self) -> Option>;
+ fn booleanHandler(&self) -> Option>;
+ fn nullHandler(&self) -> Option>;
+ fn arrayHandler(&self) -> Option>;
+ fn objectHandler(&self) -> Option>;
+ // fn stringHandler(&self) -> Option>;
}