Frontend: simplify custom predicates interfaces (#83)
* add comments detailing logic, migrate middleware::custom::tests to frontend::custom
* simplify custom predicate's frontend interfaces, making it less verbose to define Statement Template arguments
The main idea is that when defining the arguments at a statement
template, it can be done from 3 different inputs:
i. `(&str, literal)`: this is to set a POD and a field, ie. `(POD, literal("field")`)
ii. `(&str, &str)`: this is to define a origin-key wildcard pair, ie. `(src_origin, src_dest)`
iii. `Value`: this is to define a literal value, ie. `0`
This commit is contained in:
parent
d3bc892906
commit
538353a701
5 changed files with 351 additions and 273 deletions
|
|
@ -48,6 +48,12 @@ pub type Entry = (String, Value);
|
|||
#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq)]
|
||||
pub struct Value(pub [F; 4]);
|
||||
|
||||
impl ToFields for Value {
|
||||
fn to_fields(self) -> (Vec<F>, usize) {
|
||||
(self.0.to_vec(), 4)
|
||||
}
|
||||
}
|
||||
|
||||
impl Value {
|
||||
pub fn to_bytes(self) -> Vec<u8> {
|
||||
self.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue