Trait preexplorer::traits::Saveable
source · pub trait Saveable: Configurable {
// Required method
fn plotable_data(&self) -> String;
// Provided methods
fn save(&self) -> Result<&Self, PreexplorerError> { ... }
fn save_with_id<S: Display>(&self, id: S) -> Result<&Self, PreexplorerError> { ... }
}
Required Methods§
sourcefn plotable_data(&self) -> String
fn plotable_data(&self) -> String
Extract the data from the struct.
§Remarks
The data format should be directly readable by gnuplot. Look up gnuplot datafile for more information.
§Warnings
If there is no data, a warning will be printed to io::stderr
.
Provided Methods§
sourcefn save(&self) -> Result<&Self, PreexplorerError>
fn save(&self) -> Result<&Self, PreexplorerError>
Save the data in a file. The directory is target\\preexplorer\\data\\
.
§Panics
If the struct has not been given an id
, according to the Configurable
trait.
§Examples
Correctly identifying before saving.
let mut seq = (0..10).preexplore();
seq.set_id("my_id").save().unwrap();
Incorrectly identifying before saving. This panics.
ⓘ
(0..10).preexplore().save();
sourcefn save_with_id<S: Display>(&self, id: S) -> Result<&Self, PreexplorerError>
fn save_with_id<S: Display>(&self, id: S) -> Result<&Self, PreexplorerError>
Save the file with a given id
.
It does not change the current id to save the data.
§Examples
Quickly saving.
let mut seq = (0..10).preexplore();
seq.save_with_id("quick_test").unwrap();
assert_eq!(seq.id(), None);
Object Safety§
This trait is not object safe.