Skip to main content

azalea_registry_builtin/
lib.rs

1#![doc = include_str!("../README.md")]
2// used for `azalea_codec::types::ConstFromStr` impls
3#![feature(const_trait_impl, const_cmp)]
4
5// needed for the registry macro to be able to reference itself
6extern crate self as azalea_registry_builtin;
7
8use std::hash::Hash;
9
10use azalea_buf::AzBuf;
11use azalea_core::identifier::Identifier;
12
13pub mod builtin;
14
15pub trait BuiltinRegistry:
16    AzBuf + PartialEq + PartialOrd + Ord + Clone + Hash + Into<Identifier> + TryFrom<Identifier> + Clone
17{
18    const NAME: &'static str;
19
20    fn builtin_from_id(id: u32) -> Option<Self>;
21    fn builtin_into_id(&self) -> u32;
22}