pub trait DataModel<T: ProtocolModel>where
Self: Sized,{
// Required method
fn new_data_model(model: Rc<T>, type_inst: TypeInstanceObject) -> Self;
}
Expand description
The trait of the data models, which is used to read/write the typed data from/input Plumber pipe port.
A data model is created when the exec function have created the type instance object and bufferred the typed data into the type instance object. This is the Rust wrapper for the type instance object from libpstd.
This trait is usually implemented by the macro protodef!
.
It’s rare that you have to manually implement the data model class.
See the documentaiton for protodef!
macro for details.
Required Methods§
Sourcefn new_data_model(model: Rc<T>, type_inst: TypeInstanceObject) -> Self
fn new_data_model(model: Rc<T>, type_inst: TypeInstanceObject) -> Self
Create the new data type model
model
: The smart pointer for the data modeltype_inst
: The data instance object created for current task
Returns the newly created data model object
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.