diff --git a/Cargo.toml b/Cargo.toml index ad43010..ae88e4f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ paste = "1.0.14" smallvec = { version = "1.11", features = [ "const_generics", "serde" ] } serde = { version = "1.0", features = [ "derive", "rc" ] } inetnum = { version = "0.1.0", features = ["arbitrary", "serde"] } -rotonda-store = { git = "https://github.com/nlnetlabs/rotonda-store", branch = "main" } +rotonda-store = { git = "https://github.com/nlnetlabs/rotonda-store", branch = "indexed-multi-map" } routecore = { git = "https://github.com/nlnetlabs/routecore", branch = "absorb-fsm", features = ["bgp", "bmp", "serde"] } clap = { version = "4.4.6", features = ["derive"] } ariadne = "0.4.0" diff --git a/src/eval.rs b/src/eval.rs index d535ec8..feb4dd6 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -2938,6 +2938,7 @@ fn add_match_action( trait BooleanExpr: std::fmt::Debug { fn get_args(&self) -> &[symbols::Symbol]; + #[allow(dead_code)] fn get_type(&self) -> TypeDef; fn get_builtin_type(&self) -> Result; } diff --git a/src/pipeline.rs b/src/pipeline.rs index 975cbcc..60a6b69 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -135,7 +135,7 @@ pub fn run( compile(&files, &symbols, None) } -pub fn run_string<'a>( +pub fn run_string( script: String, ) -> Result, RotoReport> { let files = vec![SourceFile { name: "script".into(), contents: script }]; diff --git a/src/typechecker/mod.rs b/src/typechecker/mod.rs index 832e063..659c5fe 100644 --- a/src/typechecker/mod.rs +++ b/src/typechecker/mod.rs @@ -210,7 +210,7 @@ impl<'methods> TypeChecker<'methods> { } fn get_type(&self, type_name: impl AsRef) -> Option<&Type> { - self.types.get(&type_name.as_ref().to_string()) + self.types.get(type_name.as_ref()) } /// Check whether `a` is a subtype of `b` diff --git a/src/types/builtin/bmp_message.rs b/src/types/builtin/bmp_message.rs index 85230be..da9a7b8 100644 --- a/src/types/builtin/bmp_message.rs +++ b/src/types/builtin/bmp_message.rs @@ -370,9 +370,9 @@ bytes_record_impl!( record_field( "session_config"; 13, field( - "has_four_octet_asn"; 14, + "four_octet_enabled"; 14, Bool, - session_config.has_four_octet_asn + session_config.four_octet_enabled ), ), )], diff --git a/src/types/builtin/builtin_type_value.rs b/src/types/builtin/builtin_type_value.rs index befef91..9b2cf7c 100644 --- a/src/types/builtin/builtin_type_value.rs +++ b/src/types/builtin/builtin_type_value.rs @@ -7,7 +7,7 @@ use std::net::IpAddr; use inetnum::asn::Asn; use routecore::bgp::types::PathId; -use routecore::bgp::types::{AfiSafi, AtomicAggregate, MultiExitDisc, NextHop, Origin}; +use routecore::bgp::types::{AtomicAggregate, MultiExitDisc, NextHop, Origin}; use routecore::bgp::path_attributes::AggregatorInfo; use inetnum::addr::Prefix; use routecore::bgp::communities::HumanReadableCommunity as Community; @@ -42,7 +42,7 @@ pub enum BuiltinTypeValue { HexLiteral(HexLiteral), // scalar IpAddr(IpAddr), // scalar Prefix(Prefix), // scalar - AfiSafi(AfiSafi), // scalar + // AfiSafi(AfiSafi), // scalar PathId(PathId), // scalar PrefixLength(PrefixLength), // scalar LocalPref(routecore::bgp::types::LocalPref), // scalar @@ -94,7 +94,7 @@ impl BuiltinTypeValue { BuiltinTypeValue::IntegerLiteral(v) => v.into_type(ty), BuiltinTypeValue::StringLiteral(v) => v.into_type(ty), BuiltinTypeValue::Prefix(v) => v.into_type(ty), - BuiltinTypeValue::AfiSafi(v) => v.into_type(ty), + // BuiltinTypeValue::AfiSafi(v) => v.into_type(ty), BuiltinTypeValue::PathId(v) => v.into_type(ty), BuiltinTypeValue::PrefixLength(v) => v.into_type(ty), BuiltinTypeValue::Community(v) => v.into_type(ty), @@ -194,7 +194,7 @@ impl Display for BuiltinTypeValue { } BuiltinTypeValue::Prefix(v) => write!(f, "{}", v), BuiltinTypeValue::PathId(v) => write!(f, "{}", v), - BuiltinTypeValue::AfiSafi(v) => write!(f, "{}", v), + // BuiltinTypeValue::AfiSafi(v) => write!(f, "{}", v), BuiltinTypeValue::PrefixLength(v) => { write!(f, "{}", v) } @@ -286,7 +286,7 @@ impl Display for BuiltinTypeValue { write!(f, "{} (Const U32 Enum Variant)", v.value) } BuiltinTypeValue::Prefix(v) => write!(f, "{} (Prefix)", v), - BuiltinTypeValue::AfiSafi(v) => write!(f, "{} (AFI SAFI)", v), + // BuiltinTypeValue::AfiSafi(v) => write!(f, "{} (AFI SAFI)", v), BuiltinTypeValue::PathId(v) => write!(f, "{} (Path ID)", v), BuiltinTypeValue::PrefixLength(v) => { write!(f, "{} (Prefix Length)", v) diff --git a/src/types/builtin/primitives.rs b/src/types/builtin/primitives.rs index f9ffd0f..b707589 100644 --- a/src/types/builtin/primitives.rs +++ b/src/types/builtin/primitives.rs @@ -29,7 +29,7 @@ use inetnum::addr::Prefix; use routecore::bgp::types::PathId; use routecore::bgp::path_attributes::AggregatorInfo; use routecore::bgp::communities::HumanReadableCommunity as Community; -use routecore::bgp::types::{AfiSafi, AtomicAggregate, LocalPref, MultiExitDisc, NextHop, Origin}; +use routecore::bgp::types::{AtomicAggregate, LocalPref, MultiExitDisc, NextHop, Origin}; //------------ U16 Type ----------------------------------------------------- @@ -1076,7 +1076,7 @@ impl TryFrom<&TypeValue> for PrefixLength { //------------ AfiSafi Type -------------------------------------------------- -minimalscalartype!(AfiSafi); +// minimalscalartype!(AfiSafi); //------------ PathId Type --------------------------------------------------- diff --git a/src/types/builtin/route.rs b/src/types/builtin/route.rs index 4128ea9..35f2e79 100644 --- a/src/types/builtin/route.rs +++ b/src/types/builtin/route.rs @@ -18,7 +18,7 @@ use routecore::{ workshop::route::RouteWorkshop, ParseError, }, - Octets, + // Octets, }; use serde::Serialize; @@ -143,13 +143,13 @@ impl From<&Ipv6MulticastAddpathNlri> for PrefixNlri { pub struct PrefixRoute(pub PrefixRouteWs); #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize)] -pub enum FlowSpecNlri { +pub enum FlowSpecNlri> { Ipv4FlowSpec(Ipv4FlowSpecNlri), Ipv6FlowSpec(Ipv6FlowSpecNlri), } #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize)] -pub struct FlowSpecRoute { +pub struct FlowSpecRoute> { pub(crate) nlri: FlowSpecNlri, pub(crate) attributes: PaMap, } diff --git a/src/types/datasources.rs b/src/types/datasources.rs index e121e1c..6e27960 100644 --- a/src/types/datasources.rs +++ b/src/types/datasources.rs @@ -253,9 +253,10 @@ impl RotoRib for Rib { &prefix, &MatchOptions { match_type: MatchType::LongestMatch, - include_all_records: false, + include_withdrawn: false, include_less_specifics: false, include_more_specifics: false, + mui: None }, &guard, ) diff --git a/src/types/typedef.rs b/src/types/typedef.rs index 1724971..4d40781 100644 --- a/src/types/typedef.rs +++ b/src/types/typedef.rs @@ -15,7 +15,7 @@ use routecore::bgp::path_attributes::AggregatorInfo; use routecore::bgp::types::{AtomicAggregate, MultiExitDisc, Origin}; use routecore::bgp::{ types::PathId, - types::{AfiSafi, LocalPref}, + types::LocalPref, }; use serde::Serialize; @@ -191,7 +191,7 @@ pub enum TypeDef { Bool, Prefix, PrefixLength, // A u8 prefixes by a / - AfiSafi, + // AfiSafi, PathId, IpAddr, Asn, @@ -261,7 +261,7 @@ impl TypeDef { HexLiteral(StringLiteral,U8,U32,Community;), PrefixLength(StringLiteral,IntegerLiteral,U8,U32;), Provenance(StringLiteral;), - AfiSafi(StringLiteral;), + // AfiSafi(StringLiteral;), PeerId(StringLiteral;), PeerRibType(StringLiteral;), PathId(StringLiteral,IntegerLiteral,U32;), @@ -706,9 +706,9 @@ impl TypeDef { TypeDef::PrefixLength => { PrefixLength::get_props_for_method(self.clone(), method_name) } - TypeDef::AfiSafi => { - AfiSafi::get_props_for_method(self.clone(), method_name) - } + // TypeDef::AfiSafi => { + // AfiSafi::get_props_for_method(self.clone(), method_name) + // } TypeDef::PathId => { PathId::get_props_for_method(self.clone(), method_name) } @@ -931,7 +931,7 @@ impl std::fmt::Display for TypeDef { TypeDef::AsPath => write!(f, "AsPath"), TypeDef::Hop => write!(f, "Hop"), TypeDef::Prefix => write!(f, "Prefix"), - TypeDef::AfiSafi => write!(f, "AFI SAFI"), + // TypeDef::AfiSafi => write!(f, "AFI SAFI"), TypeDef::PathId => write!(f, "Path ID"), TypeDef::U32 => write!(f, "U32"), TypeDef::U16 => write!(f, "U16"), @@ -1169,7 +1169,7 @@ impl TryFrom for TypeDef { "HexLiteral" => Ok(TypeDef::HexLiteral), "IpAddress" => Ok(TypeDef::IpAddr), "Prefix" => Ok(TypeDef::Prefix), - "AfiSafi" => Ok(TypeDef::AfiSafi), + // "AfiSafi" => Ok(TypeDef::AfiSafi), "PathId" => Ok(TypeDef::PathId), "PrefixLength" => Ok(TypeDef::PrefixLength), "LocalPref" => Ok(TypeDef::LocalPref), @@ -1239,7 +1239,7 @@ impl TryFrom for TypeDef { "HexLiteral" => Ok(TypeDef::HexLiteral), "IpAddress" => Ok(TypeDef::IpAddr), "Prefix" => Ok(TypeDef::Prefix), - "AfiSafi" => Ok(TypeDef::AfiSafi), + // "AfiSafi" => Ok(TypeDef::AfiSafi), "PathId" => Ok(TypeDef::PathId), "PrefixLength" => Ok(TypeDef::PrefixLength), "LocalPref" => Ok(TypeDef::LocalPref), @@ -1311,7 +1311,7 @@ impl From<&BuiltinTypeValue> for TypeDef { BuiltinTypeValue::StringLiteral(_) => TypeDef::StringLiteral, BuiltinTypeValue::Bool(_) => TypeDef::Bool, BuiltinTypeValue::Prefix(_) => TypeDef::Prefix, - BuiltinTypeValue::AfiSafi(_) => TypeDef::AfiSafi, + // BuiltinTypeValue::AfiSafi(_) => TypeDef::AfiSafi, BuiltinTypeValue::PathId(_) => TypeDef::PathId, BuiltinTypeValue::PrefixLength(_) => TypeDef::PrefixLength, BuiltinTypeValue::IpAddr(_) => TypeDef::IpAddr, @@ -1381,7 +1381,7 @@ impl From for TypeDef { BuiltinTypeValue::StringLiteral(_) => TypeDef::StringLiteral, BuiltinTypeValue::Bool(_) => TypeDef::Bool, BuiltinTypeValue::Prefix(_) => TypeDef::Prefix, - BuiltinTypeValue::AfiSafi(_) => TypeDef::AfiSafi, + // BuiltinTypeValue::AfiSafi(_) => TypeDef::AfiSafi, BuiltinTypeValue::PathId(_) => TypeDef::PathId, BuiltinTypeValue::PrefixLength(_) => TypeDef::PrefixLength, BuiltinTypeValue::IpAddr(_) => TypeDef::IpAddr, diff --git a/src/types/typevalue.rs b/src/types/typevalue.rs index a899c12..7a15d0c 100644 --- a/src/types/typevalue.rs +++ b/src/types/typevalue.rs @@ -14,7 +14,7 @@ use routecore::bgp::nlri::afisafi::{ }; use routecore::bgp::types::PathId; use routecore::bgp::types::{ - AfiSafi as AfiSafiType, LocalPref, MultiExitDisc, NextHop, Origin + LocalPref, MultiExitDisc, NextHop, Origin }; use routecore::bgp::workshop::route::RouteWorkshop; use serde::Serialize; @@ -428,9 +428,9 @@ impl RotoType for TypeValue { TypeDef::PrefixLength => { PrefixLength::get_props_for_method(ty, method_name) } - TypeDef::AfiSafi => { - AfiSafiType::get_props_for_method(ty, method_name) - } + // TypeDef::AfiSafi => { + // AfiSafiType::get_props_for_method(ty, method_name) + // } TypeDef::PathId => PathId::get_props_for_method(ty, method_name), TypeDef::Record(_) => { Record::get_props_for_method(ty, method_name) @@ -507,7 +507,7 @@ impl RotoType for TypeValue { BuiltinTypeValue::Origin(v) => v.into_type(ty), BuiltinTypeValue::Prefix(v) => v.into_type(ty), BuiltinTypeValue::PrefixLength(v) => v.into_type(ty), - BuiltinTypeValue::AfiSafi(v) => v.into_type(ty), + // BuiltinTypeValue::AfiSafi(v) => v.into_type(ty), BuiltinTypeValue::PathId(v) => v.into_type(ty), BuiltinTypeValue::PrefixRoute(v) => v.into_type(ty), BuiltinTypeValue::FlowSpecRoute(v) => v.into_type(ty), @@ -731,9 +731,9 @@ impl RotoType for TypeValue { BuiltinTypeValue::Prefix(v) => { v.exec_value_method(method_token, args, res_type) } - BuiltinTypeValue::AfiSafi(v) => { - v.exec_value_method(method_token, args, res_type) - } + // BuiltinTypeValue::AfiSafi(v) => { + // v.exec_value_method(method_token, args, res_type) + // } BuiltinTypeValue::PathId(v) => { v.exec_value_method(method_token, args, res_type) } @@ -879,9 +879,9 @@ impl RotoType for TypeValue { BuiltinTypeValue::Prefix(v) => { v.exec_consume_value_method(method_token, args, res_type) } - BuiltinTypeValue::AfiSafi(v) => { - v.exec_consume_value_method(method_token, args, res_type) - } + // BuiltinTypeValue::AfiSafi(v) => { + // v.exec_consume_value_method(method_token, args, res_type) + // } BuiltinTypeValue::PathId(v) => { v.exec_consume_value_method(method_token, args, res_type) } diff --git a/tests/compare.rs b/tests/compare.rs index b6ea0b4..173697c 100644 --- a/tests/compare.rs +++ b/tests/compare.rs @@ -7,47 +7,47 @@ use roto::types::collections::Record; use roto::types::typedef::TypeDef; use roto::types::typevalue::TypeValue; use roto::vm::{self, VmResult}; -use rotonda_store::prelude::MergeUpdate; +// use rotonda_store::prelude::MergeUpdate; use inetnum::asn::Asn; mod common; -#[derive(Debug, Clone)] -struct RibValue(Vec); - -impl MergeUpdate for RibValue { - type UserDataIn = (); - type UserDataOut = (); - - fn merge_update( - &mut self, - update_record: RibValue, - _: Option<&Self::UserDataIn>, - ) -> Result<(), Box> { - self.0 = update_record.0; - Ok(()) - } - - fn clone_merge_update( - &self, - update_meta: &Self, - _: Option<&Self::UserDataIn>, - ) -> Result<(Self, Self::UserDataOut), Box> - where - Self: std::marker::Sized, - { - let mut new_meta = update_meta.0.clone(); - new_meta.push(self.0[0].clone()); - Ok((RibValue(new_meta), ())) - } -} - -impl std::fmt::Display for RibValue { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } -} +// #[derive(Debug, Clone)] +// struct RibValue(Vec); + +// impl MergeUpdate for RibValue { + // type UserDataIn = (); +// type UserDataOut = (); + +// fn merge_update( +// &mut self, +// update_record: RibValue, +// _: Option<&Self::UserDataIn>, +// ) -> Result<(), Box> { +// self.0 = update_record.0; +// Ok(()) +// } + +// fn clone_merge_update( +// &self, +// update_meta: &Self, +// _: Option<&Self::UserDataIn>, +// ) -> Result<(Self, Self::UserDataOut), Box> +// where +// Self: std::marker::Sized, +// { +// let mut new_meta = update_meta.0.clone(); +// new_meta.push(self.0[0].clone()); +// Ok((RibValue(new_meta), ())) +// } +// } + +// impl std::fmt::Display for RibValue { +// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +// write!(f, "{:?}", self.0) +// } +// } fn src_code(code_line: &str, end_accept_reject: &str) -> String { let pre = format!( diff --git a/tests/end_to_end.rs b/tests/end_to_end.rs index 0dad78f..686c27a 100644 --- a/tests/end_to_end.rs +++ b/tests/end_to_end.rs @@ -9,7 +9,7 @@ use roto::types::datasources::{DataSource, Rib}; use roto::types::typedef::TypeDef; use roto::types::typevalue::TypeValue; use roto::vm::{self, VmResult}; -use rotonda_store::prelude::MergeUpdate; +// use rotonda_store::prelude::MergeUpdate; use routecore::bgp::communities::HumanReadableCommunity as Community; use inetnum::asn::Asn; @@ -18,32 +18,32 @@ mod common; #[derive(Debug, Clone)] struct RibValue(Vec); -impl MergeUpdate for RibValue { - type UserDataIn = (); - type UserDataOut = (); - - fn merge_update( - &mut self, - update_record: RibValue, - _: Option<&Self::UserDataIn>, - ) -> Result<(), Box> { - self.0 = update_record.0; - Ok(()) - } - - fn clone_merge_update( - &self, - update_meta: &Self, - _: Option<&Self::UserDataIn>, - ) -> Result<(Self, Self::UserDataOut), Box> - where - Self: std::marker::Sized, - { - let mut new_meta = update_meta.0.clone(); - new_meta.push(self.0[0].clone()); - Ok((RibValue(new_meta), ())) - } -} +// impl MergeUpdate for RibValue { +// type UserDataIn = (); +// type UserDataOut = (); + +// fn merge_update( +// &mut self, +// update_record: RibValue, +// _: Option<&Self::UserDataIn>, +// ) -> Result<(), Box> { +// self.0 = update_record.0; +// Ok(()) +// } + +// fn clone_merge_update( +// &self, +// update_meta: &Self, +// _: Option<&Self::UserDataIn>, +// ) -> Result<(Self, Self::UserDataOut), Box> +// where +// Self: std::marker::Sized, +// { +// let mut new_meta = update_meta.0.clone(); +// new_meta.push(self.0[0].clone()); +// Ok((RibValue(new_meta), ())) +// } +// } impl std::fmt::Display for RibValue { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { diff --git a/tests/eq_conversions.rs b/tests/eq_conversions.rs index 1efa65d..ac2f8f2 100644 --- a/tests/eq_conversions.rs +++ b/tests/eq_conversions.rs @@ -7,47 +7,47 @@ use roto::types::typedef::TypeDef; use roto::types::typevalue::TypeValue; use roto::vm::{self, VmResult}; -use rotonda_store::prelude::MergeUpdate; +// use rotonda_store::prelude::MergeUpdate; use inetnum::asn::Asn; mod common; -#[derive(Debug, Clone)] -struct RibValue(Vec); - -impl MergeUpdate for RibValue { - type UserDataIn = (); - type UserDataOut = (); - - fn merge_update( - &mut self, - update_record: RibValue, - _: Option<&Self::UserDataIn>, - ) -> Result<(), Box> { - self.0 = update_record.0; - Ok(()) - } - - fn clone_merge_update( - &self, - update_meta: &Self, - _: Option<&Self::UserDataIn>, - ) -> Result<(Self, Self::UserDataOut), Box> - where - Self: std::marker::Sized, - { - let mut new_meta = update_meta.0.clone(); - new_meta.push(self.0[0].clone()); - Ok((RibValue(new_meta), ())) - } -} - -impl std::fmt::Display for RibValue { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } -} +// #[derive(Debug, Clone)] +// struct RibValue(Vec); + +// impl MergeUpdate for RibValue { +// type UserDataIn = (); +// type UserDataOut = (); + +// fn merge_update( +// &mut self, +// update_record: RibValue, +// _: Option<&Self::UserDataIn>, +// ) -> Result<(), Box> { +// self.0 = update_record.0; +// Ok(()) +// } + +// fn clone_merge_update( +// &self, +// update_meta: &Self, +// _: Option<&Self::UserDataIn>, +// ) -> Result<(Self, Self::UserDataOut), Box> +// where +// Self: std::marker::Sized, +// { +// let mut new_meta = update_meta.0.clone(); +// new_meta.push(self.0[0].clone()); +// Ok((RibValue(new_meta), ())) +// } +// } + +// impl std::fmt::Display for RibValue { +// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +// write!(f, "{:?}", self.0) +// } +// } fn src_code(code_line: &str, end_accept_reject: &str) -> String { let pre = format!( diff --git a/tests/lists.rs b/tests/lists.rs index e7645a9..5176be8 100644 --- a/tests/lists.rs +++ b/tests/lists.rs @@ -9,47 +9,47 @@ use roto::types::typedef::TypeDef; use roto::types::typevalue::TypeValue; use roto::vm::{self, VmResult}; -use rotonda_store::prelude::MergeUpdate; +// use rotonda_store::prelude::MergeUpdate; use inetnum::asn::Asn; mod common; -#[derive(Debug, Clone)] -struct RibValue(Vec); - -impl MergeUpdate for RibValue { - type UserDataIn = (); - type UserDataOut = (); - - fn merge_update( - &mut self, - update_record: RibValue, - _: Option<&Self::UserDataIn>, - ) -> Result<(), Box> { - self.0 = update_record.0; - Ok(()) - } - - fn clone_merge_update( - &self, - update_meta: &Self, - _: Option<&Self::UserDataIn>, - ) -> Result<(Self, Self::UserDataOut), Box> - where - Self: std::marker::Sized, - { - let mut new_meta = update_meta.0.clone(); - new_meta.push(self.0[0].clone()); - Ok((RibValue(new_meta), ())) - } -} - -impl std::fmt::Display for RibValue { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } -} +// #[derive(Debug, Clone)] +// struct RibValue(Vec); + +// impl MergeUpdate for RibValue { +// type UserDataIn = (); +// type UserDataOut = (); + +// fn merge_update( +// &mut self, +// update_record: RibValue, +// _: Option<&Self::UserDataIn>, +// ) -> Result<(), Box> { +// self.0 = update_record.0; +// Ok(()) +// } + +// fn clone_merge_update( +// &self, +// update_meta: &Self, +// _: Option<&Self::UserDataIn>, +// ) -> Result<(Self, Self::UserDataOut), Box> +// where +// Self: std::marker::Sized, +// { +// let mut new_meta = update_meta.0.clone(); +// new_meta.push(self.0[0].clone()); +// Ok((RibValue(new_meta), ())) +// } +// } + +// impl std::fmt::Display for RibValue { +// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +// write!(f, "{:?}", self.0) +// } +// } fn src_code(code_line: &str, end_accept_reject: &str) -> String { let pre = format!( diff --git a/tests/records.rs b/tests/records.rs index 586a28b..4f51842 100644 --- a/tests/records.rs +++ b/tests/records.rs @@ -9,47 +9,47 @@ use roto::types::typedef::TypeDef; use roto::types::typevalue::TypeValue; use roto::vm::{self, VmResult}; -use rotonda_store::prelude::MergeUpdate; +// use rotonda_store::prelude::MergeUpdate; use inetnum::asn::Asn; mod common; -#[derive(Debug, Clone)] -struct RibValue(Vec); - -impl MergeUpdate for RibValue { - type UserDataIn = (); - type UserDataOut = (); - - fn merge_update( - &mut self, - update_record: RibValue, - _: Option<&Self::UserDataIn>, - ) -> Result<(), Box> { - self.0 = update_record.0; - Ok(()) - } - - fn clone_merge_update( - &self, - update_meta: &Self, - _: Option<&Self::UserDataIn>, - ) -> Result<(Self, Self::UserDataOut), Box> - where - Self: std::marker::Sized, - { - let mut new_meta = update_meta.0.clone(); - new_meta.push(self.0[0].clone()); - Ok((RibValue(new_meta), ())) - } -} - -impl std::fmt::Display for RibValue { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } -} +// #[derive(Debug, Clone)] +// struct RibValue(Vec); + +// impl MergeUpdate for RibValue { +// type UserDataIn = (); +// type UserDataOut = (); + +// fn merge_update( +// &mut self, +// update_record: RibValue, +// _: Option<&Self::UserDataIn>, +// ) -> Result<(), Box> { +// self.0 = update_record.0; +// Ok(()) +// } + +// fn clone_merge_update( +// &self, +// update_meta: &Self, +// _: Option<&Self::UserDataIn>, +// ) -> Result<(Self, Self::UserDataOut), Box> +// where +// Self: std::marker::Sized, +// { +// let mut new_meta = update_meta.0.clone(); +// new_meta.push(self.0[0].clone()); +// Ok((RibValue(new_meta), ())) +// } +// } + +// impl std::fmt::Display for RibValue { +// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +// write!(f, "{:?}", self.0) +// } +// } fn src_code( record_assign: &str,