pub struct CustomFieldDefinition {
pub key: String,
pub field_type: CustomFieldType,
pub required: bool,
pub list: bool,
pub description: Option<String>,
}Expand description
Field definition inside a custom object type.
Fields§
§key: StringStable key used in record values (must be unique within the type).
field_type: CustomFieldTypeField value type.
required: boolWhether the field must be provided (non-null) on create/update.
list: boolWhether the field is a list of values instead of a scalar.
description: Option<String>Optional human description.
Implementations§
Source§impl CustomFieldDefinition
impl CustomFieldDefinition
Sourcepub fn validate(&self) -> Result<(), CommerceError>
pub fn validate(&self) -> Result<(), CommerceError>
Validate the definition itself (key format, etc.).
Sourcepub fn validate_value(&self, value: &Value) -> Result<(), CommerceError>
pub fn validate_value(&self, value: &Value) -> Result<(), CommerceError>
Validate a JSON value against this field definition.
Trait Implementations§
Source§impl Clone for CustomFieldDefinition
impl Clone for CustomFieldDefinition
Source§fn clone(&self) -> CustomFieldDefinition
fn clone(&self) -> CustomFieldDefinition
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 moreSource§impl Debug for CustomFieldDefinition
impl Debug for CustomFieldDefinition
Source§impl<'de> Deserialize<'de> for CustomFieldDefinition
impl<'de> Deserialize<'de> for CustomFieldDefinition
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CustomFieldDefinition, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CustomFieldDefinition, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for CustomFieldDefinition
Source§impl PartialEq for CustomFieldDefinition
impl PartialEq for CustomFieldDefinition
Source§impl Serialize for CustomFieldDefinition
impl Serialize for CustomFieldDefinition
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for CustomFieldDefinition
Auto Trait Implementations§
impl Freeze for CustomFieldDefinition
impl RefUnwindSafe for CustomFieldDefinition
impl Send for CustomFieldDefinition
impl Sync for CustomFieldDefinition
impl Unpin for CustomFieldDefinition
impl UnsafeUnpin for CustomFieldDefinition
impl UnwindSafe for CustomFieldDefinition
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