pub trait FragmentTaskOperation {
// Required methods
fn new(
id: U8Data,
fractal: FractalDescriptor,
max_iteration: u16,
resolution: Resolution,
range: Range,
) -> Self;
fn serialize(&self) -> Result<String, Error>;
fn deserialize(message: &str) -> Result<Self, Error>
where Self: Sized;
}
Required Methods§
fn new( id: U8Data, fractal: FractalDescriptor, max_iteration: u16, resolution: Resolution, range: Range, ) -> Self
Sourcefn serialize(&self) -> Result<String, Error>
fn serialize(&self) -> Result<String, Error>
Serializes a FragmentTask
into a JSON string.
This function takes a reference to a FragmentTask
and converts it into a JSON string using serde_json
. The serialization captures detailed information about the fractal task, including the type of fractal (Julia or IteratedSinZ), various parameters of the fractal, the maximum iteration count, resolution, and the range for the task.
§Arguments
request
- A reference to theFragmentTask
to be serialized.
§Returns
A Result<String, serde_json::Error>
which is Ok containing the JSON string if serialization is successful,
or an Err containing the serde_json::Error
if it fails.
Sourcefn deserialize(message: &str) -> Result<Self, Error>where
Self: Sized,
fn deserialize(message: &str) -> Result<Self, Error>where
Self: Sized,
Deserializes a JSON string into a FragmentTask
.
This function takes a string slice that holds the JSON representation of the FragmentTask
and converts it into a FragmentTask
using serde_json
. The deserialization captures detailed information about the fractal task, including the type of fractal (Julia or IteratedSinZ), various parameters of the fractal, the maximum iteration count, resolution, and the range for the task.
§Arguments
response
- A string slice that holds the JSON representation of theFragmentTask
.
§Returns
A Result<FragmentTask, serde_json::Error>
which is Ok containing the FragmentTask
if deserialization is successful,
or an Err containing the serde_json::Error
if it fails.
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.