#[non_exhaustive]pub struct DataFile {
pub motor_id: String,
pub simfile_id: String,
pub format: Format,
pub source: Option<String>,
pub license: Option<String>,
pub data: String,
pub info_url: Option<String>,
pub data_url: Option<String>,
pub source_url: Option<String>,
}Expand description
One data file of a motor.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.motor_id: StringThe motor’s ThrustCurve id.
simfile_id: StringThe file’s own id.
format: FormatIts format.
source: Option<String>Who measured it, as the API writes it: cert (a certification test), mfr (the
manufacturer) or user.
license: Option<String>Its license, as the API writes it: PD (public domain), free or other; None when the
contributor named none.
data: StringThe file, base64-encoded; DataFile::text decodes it.
info_url: Option<String>The file’s page on the site, as a path (/simfiles/{id}/).
data_url: Option<String>Where the site serves the file itself, as a path.
source_url: Option<String>The file’s page, as a full URL.
Implementations§
Source§impl DataFile
impl DataFile
Sourcepub fn text(&self) -> Result<String, ThrustCurveError>
pub fn text(&self) -> Result<String, ThrustCurveError>
The file’s text: its data decoded from base64, as UTF-8.
§Errors
ThrustCurveError::Field when the file isn’t UTF-8, or (only in a file not read by
parse_download, which refuses that) its data isn’t base64. One file that isn’t UTF-8
doesn’t refuse the answer: the motor’s other files stay readable.
Sourcepub fn read(&self) -> Result<Curve, ThrustCurveError>
pub fn read(&self) -> Result<Curve, ThrustCurveError>
The file read by hpr_motor’s reader for its format.
§Errors
As DataFile::text, and ThrustCurveError::Motor when the reader refuses the file.