client::networking

Function send_fragment_result

Source
fn send_fragment_result(
    fragment_task: &FragmentTask,
    cli_args: &CliClientArgs,
    pixel_data: PixelData,
    data: Vec<u8>,
) -> Result<TcpStream, FractalError>
Expand description

Send a FragmentResult to the server after generating a fractal image.

§Arguments

  • img - An ImageBuffer containing the fractal image.
  • fragment_task - A FragmentTask containing details such as the fractal type, resolution, and range.
  • cli_args - A CliClientArgs containing the command line arguments.
  • pixel_data - A PixelData struct containing the image data.
  • data - A Vec<u8> containing the image data.

§Return

  • Result<(), FractalError> - An io::Error if the image could not be saved.

§Details

This function converts the ImageBuffer to a Vec<u8> and then to a PixelData struct.