Struct dzahui::writer::Writer

source ·
pub(crate) struct Writer {
    pub(crate) receiver: Receiver<Vec<f64>>,
    write_path: PathBuf,
    variable_names: Vec<&'static str>,
    file_prefix: String,
}
Expand description

General Information

Writes solution of equation to a given file. Can take a path to write to, names of variables and a prefix for all files. Struct is meant to run on it’s own thread to block as little as possible the execution of DzahuiWindow

Fields

  • receiver - A sync_channel receiver to obtain vector values to write to file
  • write_path - A directory to write files in
  • variable_names - Chosen by a given equation. Normally a vector like [‘x’,‘y’,‘z’] or similar
  • file_prefix - To identify files from a single simulation

Fields§

§receiver: Receiver<Vec<f64>>§write_path: PathBuf§variable_names: Vec<&'static str>§file_prefix: String

Implementations§

General Information

Creates a new instance of writer (And there should be only one, but it is not enforced). Can be told to erase previous files on a directory. Will complain if directory is not present

Parameters
  • receiver - A receiver to obtain the solution to an equation
  • write_path - The path in which files are created and written to
  • file_prefix - Prefix for all files of a given simulation
  • variable_names - A vector with all variables of a problem. Chosen by the equation struct in dzahui window. Also determines how many elements from solution vector are taken per line
  • erase_prev_dir - Option to erase every file inside dir given. Will not erase nested directories
General Information

Writes once to a file created inside. Will create a file for every call. To make every file unique, an id must be passed. Dzahui window will pass the time in milis, but any other unique f64 value will do.

Parameters
  • &self - A reference to itself to use write_path and file_prefix
  • id - A unique id for a file
  • vals - a vector with values to write to file

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.