Struct DatapackField
pub struct DatapackField {
pub name: String,
pub kind: DatapackFieldKind,
pub default: Option<DatapackValue>,
}Expand description
One field of a registry’s entry record.
Fields§
§name: StringThe JSON key (power).
kind: DatapackFieldKindWhat the field holds.
default: Option<DatapackValue>The value of an absent field; None makes the field required.
Implementations§
§impl DatapackField
impl DatapackField
pub fn required(name: &str, kind: DatapackFieldKind) -> DatapackField
pub fn required(name: &str, kind: DatapackFieldKind) -> DatapackField
A required field.
pub fn with_default(
name: &str,
kind: DatapackFieldKind,
default: DatapackValue,
) -> DatapackField
pub fn with_default( name: &str, kind: DatapackFieldKind, default: DatapackValue, ) -> DatapackField
A field that is default when an entry leaves it out.
Trait Implementations§
§impl Clone for DatapackField
impl Clone for DatapackField
§fn clone(&self) -> DatapackField
fn clone(&self) -> DatapackField
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 DatapackField
impl Debug for DatapackField
§impl PartialEq for DatapackField
impl PartialEq for DatapackField
impl StructuralPartialEq for DatapackField
Auto Trait Implementations§
impl Freeze for DatapackField
impl RefUnwindSafe for DatapackField
impl Send for DatapackField
impl Sync for DatapackField
impl Unpin for DatapackField
impl UnsafeUnpin for DatapackField
impl UnwindSafe for DatapackField
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