pub struct StateField {
pub name: String,
pub type_name: String,
pub description: Option<String>,
pub default: Option<Value>,
pub required: bool,
}Expand description
A single field in the state schema
Fields§
§name: StringField name
type_name: StringType name (e.g., “string”, “number”, “array”, “object”)
description: Option<String>Field description
default: Option<Value>Default value
required: boolWhether this field is required
Implementations§
Source§impl StateField
impl StateField
Sourcepub fn new(name: impl Into<String>, type_name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, type_name: impl Into<String>) -> Self
Create a new state field
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set description
Sourcepub fn with_default(self, default: Value) -> Self
pub fn with_default(self, default: Value) -> Self
Set default value
Sourcepub fn with_required(self, required: bool) -> Self
pub fn with_required(self, required: bool) -> Self
Set required flag
Trait Implementations§
Source§impl Clone for StateField
impl Clone for StateField
Source§fn clone(&self) -> StateField
fn clone(&self) -> StateField
Returns a duplicate of the value. Read more
1.0.0 · 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 StateField
impl Debug for StateField
Source§impl<'de> Deserialize<'de> for StateField
impl<'de> Deserialize<'de> for StateField
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for StateField
impl RefUnwindSafe for StateField
impl Send for StateField
impl Sync for StateField
impl Unpin for StateField
impl UnsafeUnpin for StateField
impl UnwindSafe for StateField
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