aboutsummaryrefslogtreecommitdiff
path: root/common/object
diff options
context:
space:
mode:
Diffstat (limited to 'common/object')
-rw-r--r--common/object/src/registry.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/common/object/src/registry.rs b/common/object/src/registry.rs
index 39ed67a..c831b28 100644
--- a/common/object/src/registry.rs
+++ b/common/object/src/registry.rs
@@ -5,7 +5,6 @@
*/
use crate::Tag;
-use log::error;
use std::{any::TypeId, collections::BTreeMap};
pub mod types {
@@ -25,7 +24,10 @@ pub struct Registry {
impl Registry {
pub fn add(&mut self, tag: Tag, info: TagInfo) {
if let Some(other) = self.tags.get(&tag) {
- error!("Tag conflict: {:?} vs {:?}", info.name, other.name)
+ panic!(
+ "Conflicting names for tag {}: {:?} vs {:?}",
+ tag.0, info.name, other.name
+ )
}
self.tags.insert(tag, info);
}
@@ -49,7 +51,7 @@ pub struct TagInfo {
macro_rules! fields {
($($id:ident: $type:ty = $tag:literal $name:literal;)*) => {
$(pub const $id: $crate::TypedTag<$type> = $crate::TypedTag($crate::Tag($tag), std::marker::PhantomData);)*
- fn register_fields(reg: &mut $crate::Registry) {
+ pub(crate) fn register_fields(reg: &mut $crate::Registry) {
$(reg.add($crate::Tag($tag), $crate::TagInfo { name: $name, r#type: Some(std::any::TypeId::of::<$type>()) });)*
}
};