pub struct ModelInfo { /* private fields */ }Expand description
Registry of model fields for validation.
Implementations§
Source§impl ModelInfo
impl ModelInfo
Sourcepub fn load_from_json(path: &Path) -> Result<Self, Box<dyn Error>>
pub fn load_from_json(path: &Path) -> Result<Self, Box<dyn Error>>
Loads model info from a JSON file.
§Arguments
path- Path to the JSON file containing model field definitions
§Returns
A Result containing the model info or an error if loading fails.
§Example JSON format
[
{
"name": "count",
"type_name": "i32",
"is_nested": false,
"children": []
},
{
"name": "user",
"type_name": "User",
"is_nested": true,
"children": [
{"name": "name", "type_name": "String", "is_nested": false, "children": []},
{"name": "email", "type_name": "String", "is_nested": false, "children": []}
]
}
]Sourcepub fn contains_field(&self, path: &[&str]) -> bool
pub fn contains_field(&self, path: &[&str]) -> bool
Sourcepub fn top_level_fields(&self) -> Vec<&str>
pub fn top_level_fields(&self) -> Vec<&str>
Sourcepub fn all_field_paths(&self) -> Vec<String>
pub fn all_field_paths(&self) -> Vec<String>
Gets all available field paths as strings.
§Returns
A vector of all field paths (e.g., “count”, “user.name”).
Sourcepub fn add_field(&mut self, field: ModelField)
pub fn add_field(&mut self, field: ModelField)
Adds a field to the model.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModelInfo
impl RefUnwindSafe for ModelInfo
impl Send for ModelInfo
impl Sync for ModelInfo
impl Unpin for ModelInfo
impl UnwindSafe for ModelInfo
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