diff --git a/biscuit-auth/samples/README.md b/biscuit-auth/samples/README.md index 4e4a7cfb..64cede9c 100644 --- a/biscuit-auth/samples/README.md +++ b/biscuit-auth/samples/README.md @@ -3146,7 +3146,7 @@ result: `Ok(0)` ### token authority: -symbols: ["a", "equal strings"] +symbols: ["test", "a", "equal strings"] public keys: [] @@ -3162,7 +3162,7 @@ allow if true; ``` revocation ids: -- `b1696fd9f9ec456d65a863df034cb132dc7dca076d16f5bc3e73986a4cc88cc4e7902dc8519cb60961e3f33799c147f874c7e0d7e12ef1b461e361e0c0aa580b` +- `faf26fe6f5dfa08c114a0a29321405b6fb7be79b0d80694d27925f7deb01effe5707600e42fd74f9a1d2920466446d51949155f4548f0fd68f3e9326c7e12404` authorizer world: ``` diff --git a/biscuit-auth/samples/samples.json b/biscuit-auth/samples/samples.json index 1d1eeb58..4877aac5 100644 --- a/biscuit-auth/samples/samples.json +++ b/biscuit-auth/samples/samples.json @@ -2920,6 +2920,7 @@ "token": [ { "symbols": [ + "test", "a", "equal strings" ], @@ -2950,7 +2951,7 @@ }, "authorizer_code": "allow if true;\n", "revocation_ids": [ - "b1696fd9f9ec456d65a863df034cb132dc7dca076d16f5bc3e73986a4cc88cc4e7902dc8519cb60961e3f33799c147f874c7e0d7e12ef1b461e361e0c0aa580b" + "faf26fe6f5dfa08c114a0a29321405b6fb7be79b0d80694d27925f7deb01effe5707600e42fd74f9a1d2920466446d51949155f4548f0fd68f3e9326c7e12404" ] } } diff --git a/biscuit-auth/samples/test035_ffi.bc b/biscuit-auth/samples/test035_ffi.bc index 6387dfaa..d5bb3a8d 100644 Binary files a/biscuit-auth/samples/test035_ffi.bc and b/biscuit-auth/samples/test035_ffi.bc differ diff --git a/biscuit-auth/src/datalog/expression.rs b/biscuit-auth/src/datalog/expression.rs index e26f3836..ecb47a28 100644 --- a/biscuit-auth/src/datalog/expression.rs +++ b/biscuit-auth/src/datalog/expression.rs @@ -1,6 +1,6 @@ use crate::{builder, error}; -use super::{MapKey, Term}; +use super::{MapKey, SymbolIndex, Term}; use super::{SymbolTable, TemporarySymbolTable}; use regex::Regex; use std::sync::Arc; @@ -71,7 +71,7 @@ pub enum Unary { Parens, Length, TypeOf, - Ffi(String), + Ffi(SymbolIndex), } impl Unary { @@ -109,10 +109,14 @@ impl Unary { Ok(Term::Str(sym)) } (Unary::Ffi(name), i) => { + let name = symbols + .get_symbol(*name) + .ok_or(error::Expression::UnknownSymbol(*name))? + .to_owned(); let fun = extern_funcs - .get(name) + .get(&name) .ok_or(error::Expression::UndefinedExtern(name.to_owned()))?; - fun.call(symbols, name, i, None) + fun.call(symbols, &name, i, None) } _ => { //println!("unexpected value type on the stack"); @@ -121,13 +125,15 @@ impl Unary { } } - pub fn print(&self, value: String, _symbols: &SymbolTable) -> String { + pub fn print(&self, value: String, symbols: &SymbolTable) -> String { match self { Unary::Negate => format!("!{}", value), Unary::Parens => format!("({})", value), Unary::Length => format!("{}.length()", value), Unary::TypeOf => format!("{}.type()", value), - Unary::Ffi(name) => format!("{value}.extern::{name}()"), + Unary::Ffi(name) => { + format!("{value}.extern::{}()", symbols.print_symbol_default(*name)) + } } } } @@ -163,7 +169,7 @@ pub enum Binary { All, Any, Get, - Ffi(String), + Ffi(SymbolIndex), } impl Binary { @@ -501,10 +507,14 @@ impl Binary { // FFI (Binary::Ffi(name), left, right) => { + let name = symbols + .get_symbol(*name) + .ok_or(error::Expression::UnknownSymbol(*name))? + .to_owned(); let fun = extern_funcs - .get(name) + .get(&name) .ok_or(error::Expression::UndefinedExtern(name.to_owned()))?; - fun.call(symbols, name, left, Some(right)) + fun.call(symbols, &name, left, Some(right)) } _ => { @@ -514,7 +524,7 @@ impl Binary { } } - pub fn print(&self, left: String, right: String, _symbols: &SymbolTable) -> String { + pub fn print(&self, left: String, right: String, symbols: &SymbolTable) -> String { match self { Binary::LessThan => format!("{} < {}", left, right), Binary::GreaterThan => format!("{} > {}", left, right), @@ -544,7 +554,10 @@ impl Binary { Binary::All => format!("{left}.all({right})"), Binary::Any => format!("{left}.any({right})"), Binary::Get => format!("{left}.get({right})"), - Binary::Ffi(name) => format!("{left}.extern::{name}({right})"), + Binary::Ffi(name) => format!( + "{left}.extern::{}({right})", + symbols.print_symbol_default(*name) + ), } } } @@ -1676,64 +1689,69 @@ mod tests { let mut symbols = SymbolTable::new(); let i = symbols.insert("test"); let j = symbols.insert("TeSt"); + let test_bin = symbols.insert("test_bin"); + let test_un = symbols.insert("test_un"); + let test_closure = symbols.insert("test_closure"); + let test_fn = symbols.insert("test_fn"); + let id_fn = symbols.insert("id"); let mut tmp_symbols = TemporarySymbolTable::new(&symbols); let ops = vec![ Op::Value(Term::Integer(60)), Op::Value(Term::Integer(0)), - Op::Binary(Binary::Ffi("test_bin".to_owned())), + Op::Binary(Binary::Ffi(test_bin)), Op::Value(Term::Str(i)), Op::Value(Term::Str(j)), - Op::Binary(Binary::Ffi("test_bin".to_owned())), + Op::Binary(Binary::Ffi(test_bin)), Op::Binary(Binary::And), Op::Value(Term::Integer(42)), - Op::Unary(Unary::Ffi("test_un".to_owned())), + Op::Unary(Unary::Ffi(test_un)), Op::Binary(Binary::And), Op::Value(Term::Integer(42)), - Op::Unary(Unary::Ffi("test_closure".to_owned())), + Op::Unary(Unary::Ffi(test_closure)), Op::Binary(Binary::And), Op::Value(Term::Str(i)), - Op::Unary(Unary::Ffi("test_closure".to_owned())), + Op::Unary(Unary::Ffi(test_closure)), Op::Binary(Binary::And), Op::Value(Term::Integer(42)), - Op::Unary(Unary::Ffi("test_fn".to_owned())), + Op::Unary(Unary::Ffi(test_fn)), Op::Binary(Binary::And), Op::Value(Term::Integer(42)), - Op::Unary(Unary::Ffi("id".to_owned())), + Op::Unary(Unary::Ffi(id_fn)), Op::Value(Term::Integer(42)), Op::Binary(Binary::HeterogeneousEqual), Op::Binary(Binary::And), Op::Value(Term::Str(i)), - Op::Unary(Unary::Ffi("id".to_owned())), + Op::Unary(Unary::Ffi(id_fn)), Op::Value(Term::Str(i)), Op::Binary(Binary::HeterogeneousEqual), Op::Binary(Binary::And), Op::Value(Term::Bool(true)), - Op::Unary(Unary::Ffi("id".to_owned())), + Op::Unary(Unary::Ffi(id_fn)), Op::Value(Term::Bool(true)), Op::Binary(Binary::HeterogeneousEqual), Op::Binary(Binary::And), Op::Value(Term::Date(0)), - Op::Unary(Unary::Ffi("id".to_owned())), + Op::Unary(Unary::Ffi(id_fn)), Op::Value(Term::Date(0)), Op::Binary(Binary::HeterogeneousEqual), Op::Binary(Binary::And), Op::Value(Term::Bytes(vec![42])), - Op::Unary(Unary::Ffi("id".to_owned())), + Op::Unary(Unary::Ffi(id_fn)), Op::Value(Term::Bytes(vec![42])), Op::Binary(Binary::HeterogeneousEqual), Op::Binary(Binary::And), Op::Value(Term::Null), - Op::Unary(Unary::Ffi("id".to_owned())), + Op::Unary(Unary::Ffi(id_fn)), Op::Value(Term::Null), Op::Binary(Binary::HeterogeneousEqual), Op::Binary(Binary::And), Op::Value(Term::Array(vec![Term::Null])), - Op::Unary(Unary::Ffi("id".to_owned())), + Op::Unary(Unary::Ffi(id_fn)), Op::Value(Term::Array(vec![Term::Null])), Op::Binary(Binary::HeterogeneousEqual), Op::Binary(Binary::And), Op::Value(Term::Set(BTreeSet::from([Term::Null]))), - Op::Unary(Unary::Ffi("id".to_owned())), + Op::Unary(Unary::Ffi(id_fn)), Op::Value(Term::Set(BTreeSet::from([Term::Null]))), Op::Binary(Binary::HeterogeneousEqual), Op::Binary(Binary::And), @@ -1741,7 +1759,7 @@ mod tests { (MapKey::Integer(42), Term::Null), (MapKey::Str(i), Term::Null), ]))), - Op::Unary(Unary::Ffi("id".to_owned())), + Op::Unary(Unary::Ffi(id_fn)), Op::Value(Term::Map(BTreeMap::from([ (MapKey::Integer(42), Term::Null), (MapKey::Str(i), Term::Null), diff --git a/biscuit-auth/src/format/convert.rs b/biscuit-auth/src/format/convert.rs index 53225d59..df8fa290 100644 --- a/biscuit-auth/src/format/convert.rs +++ b/biscuit-auth/src/format/convert.rs @@ -744,7 +744,7 @@ pub mod v2 { (Some(op_unary::Kind::Parens), None) => Op::Unary(Unary::Parens), (Some(op_unary::Kind::Length), None) => Op::Unary(Unary::Length), (Some(op_unary::Kind::TypeOf), None) => Op::Unary(Unary::TypeOf), - (Some(op_unary::Kind::Ffi), Some(n)) => Op::Unary(Unary::Ffi(n.to_owned())), + (Some(op_unary::Kind::Ffi), Some(n)) => Op::Unary(Unary::Ffi(*n)), (Some(op_unary::Kind::Ffi), None) => { return Err(error::Format::DeserializationError( "deserialization error: missing ffi name".to_string(), @@ -799,7 +799,7 @@ pub mod v2 { (Some(op_binary::Kind::All), None) => Op::Binary(Binary::All), (Some(op_binary::Kind::Any), None) => Op::Binary(Binary::Any), (Some(op_binary::Kind::Get), None) => Op::Binary(Binary::Get), - (Some(op_binary::Kind::Ffi), Some(n)) => Op::Binary(Binary::Ffi(n.to_owned())), + (Some(op_binary::Kind::Ffi), Some(n)) => Op::Binary(Binary::Ffi(*n)), (Some(op_binary::Kind::Ffi), None) => { return Err(error::Format::DeserializationError( "deserialization error: missing ffi name".to_string(), diff --git a/biscuit-auth/src/format/schema.proto b/biscuit-auth/src/format/schema.proto index 5524582e..c71108d8 100644 --- a/biscuit-auth/src/format/schema.proto +++ b/biscuit-auth/src/format/schema.proto @@ -151,7 +151,7 @@ message OpUnary { } required Kind kind = 1; - optional string ffiName = 2; + optional uint64 ffiName = 2; } message OpBinary { @@ -188,7 +188,7 @@ message OpBinary { } required Kind kind = 1; - optional string ffiName = 2; + optional uint64 ffiName = 2; } message OpClosure { diff --git a/biscuit-auth/src/format/schema.rs b/biscuit-auth/src/format/schema.rs index fda4fdc9..ede2c0b2 100644 --- a/biscuit-auth/src/format/schema.rs +++ b/biscuit-auth/src/format/schema.rs @@ -233,8 +233,8 @@ pub mod op { pub struct OpUnary { #[prost(enumeration="op_unary::Kind", required, tag="1")] pub kind: i32, - #[prost(string, optional, tag="2")] - pub ffi_name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(uint64, optional, tag="2")] + pub ffi_name: ::core::option::Option, } /// Nested message and enum types in `OpUnary`. pub mod op_unary { @@ -252,8 +252,8 @@ pub mod op_unary { pub struct OpBinary { #[prost(enumeration="op_binary::Kind", required, tag="1")] pub kind: i32, - #[prost(string, optional, tag="2")] - pub ffi_name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(uint64, optional, tag="2")] + pub ffi_name: ::core::option::Option, } /// Nested message and enum types in `OpBinary`. pub mod op_binary { diff --git a/biscuit-auth/src/token/builder.rs b/biscuit-auth/src/token/builder.rs index abd3d867..248afe6e 100644 --- a/biscuit-auth/src/token/builder.rs +++ b/biscuit-auth/src/token/builder.rs @@ -17,7 +17,10 @@ use std::{ }; // reexport those because the builder uses the same definitions -pub use crate::datalog::{Binary, Expression as DatalogExpression, Op as DatalogOp, Unary}; +pub use crate::datalog::{ + Binary as DatalogBinary, Expression as DatalogExpression, Op as DatalogOp, + Unary as DatalogUnary, +}; /// creates a Block content to append to an existing token #[derive(Clone, Debug, Default)] @@ -419,6 +422,50 @@ pub trait Convert: Sized { } } +/// Builder for a unary operation +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub enum Unary { + Negate, + Parens, + Length, + TypeOf, + Ffi(String), +} + +/// Builder for a binary operation +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub enum Binary { + LessThan, + GreaterThan, + LessOrEqual, + GreaterOrEqual, + Equal, + Contains, + Prefix, + Suffix, + Regex, + Add, + Sub, + Mul, + Div, + And, + Or, + Intersection, + Union, + BitwiseAnd, + BitwiseOr, + BitwiseXor, + NotEqual, + HeterogeneousEqual, + HeterogeneousNotEqual, + LazyAnd, + LazyOr, + All, + Any, + Get, + Ffi(String), +} + /// Builder for a Datalog value #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum Term { @@ -1191,8 +1238,8 @@ impl Convert for Op { fn convert(&self, symbols: &mut SymbolTable) -> datalog::Op { match self { Op::Value(t) => datalog::Op::Value(t.convert(symbols)), - Op::Unary(u) => datalog::Op::Unary(u.clone()), - Op::Binary(b) => datalog::Op::Binary(b.clone()), + Op::Unary(u) => datalog::Op::Unary(u.convert(symbols)), + Op::Binary(b) => datalog::Op::Binary(b.convert(symbols)), Op::Closure(ps, os) => datalog::Op::Closure( ps.iter().map(|p| symbols.insert(p) as u32).collect(), os.iter().map(|o| o.convert(symbols)).collect(), @@ -1203,8 +1250,8 @@ impl Convert for Op { fn convert_from(op: &datalog::Op, symbols: &SymbolTable) -> Result { Ok(match op { datalog::Op::Value(t) => Op::Value(Term::convert_from(t, symbols)?), - datalog::Op::Unary(u) => Op::Unary(u.clone()), - datalog::Op::Binary(b) => Op::Binary(b.clone()), + datalog::Op::Unary(u) => Op::Unary(Unary::convert_from(u, symbols)?), + datalog::Op::Binary(b) => Op::Binary(Binary::convert_from(b, symbols)?), datalog::Op::Closure(ps, os) => Op::Closure( ps.iter() .map(|p| symbols.print_symbol(*p as u64)) @@ -1230,6 +1277,28 @@ impl From for Op { } } +impl Convert for Unary { + fn convert(&self, symbols: &mut SymbolTable) -> datalog::Unary { + match self { + Unary::Negate => datalog::Unary::Negate, + Unary::Parens => datalog::Unary::Parens, + Unary::Length => datalog::Unary::Length, + Unary::TypeOf => datalog::Unary::TypeOf, + Unary::Ffi(n) => datalog::Unary::Ffi(symbols.insert(n)), + } + } + + fn convert_from(f: &datalog::Unary, symbols: &SymbolTable) -> Result { + match f { + datalog::Unary::Negate => Ok(Unary::Negate), + datalog::Unary::Parens => Ok(Unary::Parens), + datalog::Unary::Length => Ok(Unary::Length), + datalog::Unary::TypeOf => Ok(Unary::TypeOf), + datalog::Unary::Ffi(i) => Ok(Unary::Ffi(symbols.print_symbol(*i)?)), + } + } +} + impl From for Unary { fn from(unary: biscuit_parser::builder::Unary) -> Self { match unary { @@ -1242,6 +1311,76 @@ impl From for Unary { } } +impl Convert for Binary { + fn convert(&self, symbols: &mut SymbolTable) -> datalog::Binary { + match self { + Binary::LessThan => datalog::Binary::LessThan, + Binary::GreaterThan => datalog::Binary::GreaterThan, + Binary::LessOrEqual => datalog::Binary::LessOrEqual, + Binary::GreaterOrEqual => datalog::Binary::GreaterOrEqual, + Binary::Equal => datalog::Binary::Equal, + Binary::Contains => datalog::Binary::Contains, + Binary::Prefix => datalog::Binary::Prefix, + Binary::Suffix => datalog::Binary::Suffix, + Binary::Regex => datalog::Binary::Regex, + Binary::Add => datalog::Binary::Add, + Binary::Sub => datalog::Binary::Sub, + Binary::Mul => datalog::Binary::Mul, + Binary::Div => datalog::Binary::Div, + Binary::And => datalog::Binary::And, + Binary::Or => datalog::Binary::Or, + Binary::Intersection => datalog::Binary::Intersection, + Binary::Union => datalog::Binary::Union, + Binary::BitwiseAnd => datalog::Binary::BitwiseAnd, + Binary::BitwiseOr => datalog::Binary::BitwiseOr, + Binary::BitwiseXor => datalog::Binary::BitwiseXor, + Binary::NotEqual => datalog::Binary::NotEqual, + Binary::HeterogeneousEqual => datalog::Binary::HeterogeneousEqual, + Binary::HeterogeneousNotEqual => datalog::Binary::HeterogeneousNotEqual, + Binary::LazyAnd => datalog::Binary::LazyAnd, + Binary::LazyOr => datalog::Binary::LazyOr, + Binary::All => datalog::Binary::All, + Binary::Any => datalog::Binary::Any, + Binary::Get => datalog::Binary::Get, + Binary::Ffi(n) => datalog::Binary::Ffi(symbols.insert(n)), + } + } + + fn convert_from(f: &datalog::Binary, symbols: &SymbolTable) -> Result { + match f { + datalog::Binary::LessThan => Ok(Binary::LessThan), + datalog::Binary::GreaterThan => Ok(Binary::GreaterThan), + datalog::Binary::LessOrEqual => Ok(Binary::LessOrEqual), + datalog::Binary::GreaterOrEqual => Ok(Binary::GreaterOrEqual), + datalog::Binary::Equal => Ok(Binary::Equal), + datalog::Binary::Contains => Ok(Binary::Contains), + datalog::Binary::Prefix => Ok(Binary::Prefix), + datalog::Binary::Suffix => Ok(Binary::Suffix), + datalog::Binary::Regex => Ok(Binary::Regex), + datalog::Binary::Add => Ok(Binary::Add), + datalog::Binary::Sub => Ok(Binary::Sub), + datalog::Binary::Mul => Ok(Binary::Mul), + datalog::Binary::Div => Ok(Binary::Div), + datalog::Binary::And => Ok(Binary::And), + datalog::Binary::Or => Ok(Binary::Or), + datalog::Binary::Intersection => Ok(Binary::Intersection), + datalog::Binary::Union => Ok(Binary::Union), + datalog::Binary::BitwiseAnd => Ok(Binary::BitwiseAnd), + datalog::Binary::BitwiseOr => Ok(Binary::BitwiseOr), + datalog::Binary::BitwiseXor => Ok(Binary::BitwiseXor), + datalog::Binary::NotEqual => Ok(Binary::NotEqual), + datalog::Binary::HeterogeneousEqual => Ok(Binary::HeterogeneousEqual), + datalog::Binary::HeterogeneousNotEqual => Ok(Binary::HeterogeneousNotEqual), + datalog::Binary::LazyAnd => Ok(Binary::LazyAnd), + datalog::Binary::LazyOr => Ok(Binary::LazyOr), + datalog::Binary::All => Ok(Binary::All), + datalog::Binary::Any => Ok(Binary::Any), + datalog::Binary::Get => Ok(Binary::Get), + datalog::Binary::Ffi(i) => Ok(Binary::Ffi(symbols.print_symbol(*i)?)), + } + } +} + impl From for Binary { fn from(binary: biscuit_parser::builder::Binary) -> Self { match binary { diff --git a/biscuit-parser/src/builder.rs b/biscuit-parser/src/builder.rs index 486fd85b..4a993157 100644 --- a/biscuit-parser/src/builder.rs +++ b/biscuit-parser/src/builder.rs @@ -341,11 +341,11 @@ impl ToTokens for Op { impl ToTokens for Unary { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { tokens.extend(match self { - Unary::Negate => quote! {::biscuit_auth::datalog::Unary::Negate }, - Unary::Parens => quote! {::biscuit_auth::datalog::Unary::Parens }, - Unary::Length => quote! {::biscuit_auth::datalog::Unary::Length }, - Unary::TypeOf => quote! {::biscuit_auth::datalog::Unary::TypeOf }, - Unary::Ffi(name) => quote! {::biscuit_auth::datalog::Unary::Ffi(#name.to_string()) }, + Unary::Negate => quote! {::biscuit_auth::builder::Unary::Negate }, + Unary::Parens => quote! {::biscuit_auth::builder::Unary::Parens }, + Unary::Length => quote! {::biscuit_auth::builder::Unary::Length }, + Unary::TypeOf => quote! {::biscuit_auth::builder::Unary::TypeOf }, + Unary::Ffi(name) => quote! {::biscuit_auth::builder::Unary::Ffi(#name.to_string()) }, }); } } @@ -354,39 +354,39 @@ impl ToTokens for Unary { impl ToTokens for Binary { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { tokens.extend(match self { - Binary::LessThan => quote! { ::biscuit_auth::datalog::Binary::LessThan }, - Binary::GreaterThan => quote! { ::biscuit_auth::datalog::Binary::GreaterThan }, - Binary::LessOrEqual => quote! { ::biscuit_auth::datalog::Binary::LessOrEqual }, - Binary::GreaterOrEqual => quote! { ::biscuit_auth::datalog::Binary::GreaterOrEqual }, - Binary::Equal => quote! { ::biscuit_auth::datalog::Binary::Equal }, - Binary::Contains => quote! { ::biscuit_auth::datalog::Binary::Contains }, - Binary::Prefix => quote! { ::biscuit_auth::datalog::Binary::Prefix }, - Binary::Suffix => quote! { ::biscuit_auth::datalog::Binary::Suffix }, - Binary::Regex => quote! { ::biscuit_auth::datalog::Binary::Regex }, - Binary::Add => quote! { ::biscuit_auth::datalog::Binary::Add }, - Binary::Sub => quote! { ::biscuit_auth::datalog::Binary::Sub }, - Binary::Mul => quote! { ::biscuit_auth::datalog::Binary::Mul }, - Binary::Div => quote! { ::biscuit_auth::datalog::Binary::Div }, - Binary::And => quote! { ::biscuit_auth::datalog::Binary::And }, - Binary::Or => quote! { ::biscuit_auth::datalog::Binary::Or }, - Binary::Intersection => quote! { ::biscuit_auth::datalog::Binary::Intersection }, - Binary::Union => quote! { ::biscuit_auth::datalog::Binary::Union }, - Binary::BitwiseAnd => quote! { ::biscuit_auth::datalog::Binary::BitwiseAnd }, - Binary::BitwiseOr => quote! { ::biscuit_auth::datalog::Binary::BitwiseOr }, - Binary::BitwiseXor => quote! { ::biscuit_auth::datalog::Binary::BitwiseXor }, - Binary::NotEqual => quote! { ::biscuit_auth::datalog::Binary::NotEqual }, + Binary::LessThan => quote! { ::biscuit_auth::builder::Binary::LessThan }, + Binary::GreaterThan => quote! { ::biscuit_auth::builder::Binary::GreaterThan }, + Binary::LessOrEqual => quote! { ::biscuit_auth::builder::Binary::LessOrEqual }, + Binary::GreaterOrEqual => quote! { ::biscuit_auth::builder::Binary::GreaterOrEqual }, + Binary::Equal => quote! { ::biscuit_auth::builder::Binary::Equal }, + Binary::Contains => quote! { ::biscuit_auth::builder::Binary::Contains }, + Binary::Prefix => quote! { ::biscuit_auth::builder::Binary::Prefix }, + Binary::Suffix => quote! { ::biscuit_auth::builder::Binary::Suffix }, + Binary::Regex => quote! { ::biscuit_auth::builder::Binary::Regex }, + Binary::Add => quote! { ::biscuit_auth::builder::Binary::Add }, + Binary::Sub => quote! { ::biscuit_auth::builder::Binary::Sub }, + Binary::Mul => quote! { ::biscuit_auth::builder::Binary::Mul }, + Binary::Div => quote! { ::biscuit_auth::builder::Binary::Div }, + Binary::And => quote! { ::biscuit_auth::builder::Binary::And }, + Binary::Or => quote! { ::biscuit_auth::builder::Binary::Or }, + Binary::Intersection => quote! { ::biscuit_auth::builder::Binary::Intersection }, + Binary::Union => quote! { ::biscuit_auth::builder::Binary::Union }, + Binary::BitwiseAnd => quote! { ::biscuit_auth::builder::Binary::BitwiseAnd }, + Binary::BitwiseOr => quote! { ::biscuit_auth::builder::Binary::BitwiseOr }, + Binary::BitwiseXor => quote! { ::biscuit_auth::builder::Binary::BitwiseXor }, + Binary::NotEqual => quote! { ::biscuit_auth::builder::Binary::NotEqual }, Binary::HeterogeneousEqual => { - quote! { ::biscuit_auth::datalog::Binary::HeterogeneousEqual} + quote! { ::biscuit_auth::builder::Binary::HeterogeneousEqual} } Binary::HeterogeneousNotEqual => { - quote! { ::biscuit_auth::datalog::Binary::HeterogeneousNotEqual} + quote! { ::biscuit_auth::builder::Binary::HeterogeneousNotEqual} } - Binary::LazyAnd => quote! { ::biscuit_auth::datalog::Binary::LazyAnd }, - Binary::LazyOr => quote! { ::biscuit_auth::datalog::Binary::LazyOr }, - Binary::All => quote! { ::biscuit_auth::datalog::Binary::All }, - Binary::Any => quote! { ::biscuit_auth::datalog::Binary::Any }, - Binary::Get => quote! { ::biscuit_auth::datalog::Binary::Get }, - Binary::Ffi(name) => quote! {::biscuit_auth::datalog::Binary::Ffi(#name.to_string()) }, + Binary::LazyAnd => quote! { ::biscuit_auth::builder::Binary::LazyAnd }, + Binary::LazyOr => quote! { ::biscuit_auth::builder::Binary::LazyOr }, + Binary::All => quote! { ::biscuit_auth::builder::Binary::All }, + Binary::Any => quote! { ::biscuit_auth::builder::Binary::Any }, + Binary::Get => quote! { ::biscuit_auth::builder::Binary::Get }, + Binary::Ffi(name) => quote! {::biscuit_auth::builder::Binary::Ffi(#name.to_string()) }, }); } }