Crate citi[][src]

Expand description

Input/Output for CITI records

The standard, defines the following entities:

NameDescription
RecordThe entire contents of the record
HeaderHeader of the record
DataOne or more data arrays
KeywordDefine the header contents

As this is a custom ASCII record type, the standard is not as simple as one would like. The standard is followed as closely as is reasonable. The largest changes are in the extension of the keywords.

Non-Standard Type

A non-standard but industry prevelent comment section is added formated with a bang:

!COMMENT

These are used to provide internal comments.

IO Example

The object must implement the BufRead trait since CITI files are read line-by-line. As a result, two reads will lead to a fail on the second read, since the buffer is empty.

Read file:

use citi::Record;
use std::fs::File;

let mut file = File::open("file.cti").unwrap();
let record = Record::from_reader(&mut file);

Write file:

use citi::Record;
use std::fs::File;

let record = Record::default();
let mut file = File::create("file.cti").unwrap();
record.to_writer(&mut file);

Input-Output Consistency:

General input-output consistency cannot be guaranteed with CITI records because of their design. That is, if a record is read in and read out, the byte representation of the record may change, exact floating point representations may change, but the record will contain the same information. The following is not guaranteed:

  • ASCII representation of floating points may change because of the String -> Float -> String conversion.
  • Floats may be shifted in exponential format.
  • All SEG_LIST keywords will be converted to VAR_LIST

Macros

Relative assert on two arrays

Relative assert on two arrays of complex numbers

Assert two files on disk are equal

Structs

Define a constant in the file

A named, formatted, data array

Device-specific value.

The file header

Representation of a file

The independent variable

Enums

Crate error

Representation of the per-line keywords

Error from parsing a line

Error during reading

Error during writing

Type Definitions

Crate interface result