pub trait RobotModuleSaveAndLoadwhere
Self: Serialize + DeserializeOwned,{
// Required method
fn get_robot_name(&self) -> &str;
// Provided methods
fn save_to_json_file(
&self,
robot_module_json_type: RobotModuleJsonType,
) -> Result<(), OptimaError>
where Self: Sized { ... }
fn load_from_json_file(
robot_name: &str,
robot_module_json_type: RobotModuleJsonType,
) -> Result<Self, OptimaError> { ... }
}
Expand description
Trait that can be implemented by robot modules to allow for easy serializing and deserializing to and from json files. The only functions that must be implemented for this trait are get_robot_name() and get_robot_module_json_type().
Required Methods§
fn get_robot_name(&self) -> &str
Provided Methods§
fn save_to_json_file(
&self,
robot_module_json_type: RobotModuleJsonType,
) -> Result<(), OptimaError>where
Self: Sized,
fn load_from_json_file( robot_name: &str, robot_module_json_type: RobotModuleJsonType, ) -> Result<Self, OptimaError>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.