pub trait SmartSerde: Serialize + DeserializeOwned {
// Provided methods
fn to_file(
&self,
file_path: impl AsRef<Path>,
override_existing: bool,
) -> Result<()> { ... }
fn from_file_typed(
file_path: impl AsRef<Path>,
) -> Result<Self, SerdeFileError> { ... }
fn from_file(file_path: impl AsRef<Path>, name: &str) -> Result<Self> { ... }
fn from_str(contents: String, format: &str, name: &str) -> Result<Self> { ... }
fn has_schema_path(&self, _online: bool) -> Option<Result<PathBuf>> { ... }
}Provided Methods§
fn to_file( &self, file_path: impl AsRef<Path>, override_existing: bool, ) -> Result<()>
Sourcefn from_file_typed(file_path: impl AsRef<Path>) -> Result<Self, SerdeFileError>
fn from_file_typed(file_path: impl AsRef<Path>) -> Result<Self, SerdeFileError>
Loads and deserializes data from a file with typed error handling.
This function differentiates between file errors (e.g., file not found)
and parse errors (e.g., invalid JSON/YAML/TOML syntax) using SerdeFileError.
§Arguments
file_path- Path to the file to load_name- Name of the data type being loaded (for error messages, currently unused)
§Returns
Ok(Self)- Successfully loaded and parsed dataErr(SerdeFileError)- Typed error indicating whether it was a file or parse error
fn from_file(file_path: impl AsRef<Path>, name: &str) -> Result<Self>
fn from_str(contents: String, format: &str, name: &str) -> Result<Self>
fn has_schema_path(&self, _online: bool) -> Option<Result<PathBuf>>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".