pub struct Field {
pub name: String,
pub description: Option<String>,
pub kind: FieldType,
pub required: bool,
pub allowed: Vec<String>,
}Expand description
One property of an object schema.
Fields§
§name: String§description: Option<String>§kind: FieldType§required: bool§allowed: Vec<String>When set, the value must be one of these — a closed set an agent can see.
Implementations§
Source§impl Field
impl Field
pub fn new(name: impl Into<String>, kind: FieldType) -> Self
pub fn string(name: impl Into<String>) -> Self
pub fn number(name: impl Into<String>) -> Self
pub fn integer(name: impl Into<String>) -> Self
pub fn boolean(name: impl Into<String>) -> Self
pub fn array_of(name: impl Into<String>, item: FieldType) -> Self
pub fn object(name: impl Into<String>, schema: Schema) -> Self
pub fn any(name: impl Into<String>) -> Self
Sourcepub fn describe(self, description: impl Into<String>) -> Self
pub fn describe(self, description: impl Into<String>) -> Self
The sentence the calling model reads to decide what to put here.
pub fn optional(self) -> Self
Trait Implementations§
impl StructuralPartialEq for Field
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnsafeUnpin for Field
impl UnwindSafe for Field
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