Struct DatapackRegistryDeclaration
pub struct DatapackRegistryDeclaration {
pub mod_id: String,
pub key: String,
pub fields: Vec<DatapackField>,
pub sync: DatapackRegistrySync,
}Expand description
A registry the mod declared, as the game reads it.
Fields§
§mod_id: StringThe declaring mod’s id.
key: StringThe registry’s namespaced key (mymod:spell).
fields: Vec<DatapackField>The entry record, in the order the decoded entry lists it.
sync: DatapackRegistrySyncHow clients receive the entries.
Implementations§
§impl DatapackRegistryDeclaration
impl DatapackRegistryDeclaration
pub fn entry_file(&self, entry: &str) -> Option<String>
pub fn entry_file(&self, entry: &str) -> Option<String>
The file an entry entry (addon:fire) of this registry (example:spell)
sits in, inside a data pack: data/addon/example/spell/fire.json.
pub fn decode_entry(
&self,
text: &str,
) -> Result<DatapackEntry, DatapackDecodeError>
pub fn decode_entry( &self, text: &str, ) -> Result<DatapackEntry, DatapackDecodeError>
Decodes one entry file against the schema. A key the schema does not declare, a missing required key, a wrong type or an out-of-range value fails the whole entry, and no default stands in for invalid data. Nothing here runs mod code. The engine adds no size or field-count limit of its own; nesting is bounded by the JSON parser’s recursion limit.
Trait Implementations§
§impl Clone for DatapackRegistryDeclaration
impl Clone for DatapackRegistryDeclaration
§fn clone(&self) -> DatapackRegistryDeclaration
fn clone(&self) -> DatapackRegistryDeclaration
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for DatapackRegistryDeclaration
impl Debug for DatapackRegistryDeclaration
§impl PartialEq for DatapackRegistryDeclaration
impl PartialEq for DatapackRegistryDeclaration
impl StructuralPartialEq for DatapackRegistryDeclaration
Auto Trait Implementations§
impl Freeze for DatapackRegistryDeclaration
impl RefUnwindSafe for DatapackRegistryDeclaration
impl Send for DatapackRegistryDeclaration
impl Sync for DatapackRegistryDeclaration
impl Unpin for DatapackRegistryDeclaration
impl UnsafeUnpin for DatapackRegistryDeclaration
impl UnwindSafe for DatapackRegistryDeclaration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more