Expand description
Bounded native input adapters for application hosts.
This crate parses external text into validated phasesmith-model and
crystallographic records. It owns syntax, provenance, diagnostics, format
detection, and pre-allocation limits; it does not own refinement or GUI
state. Applications normally use it through
phasesmith::io.
§Powder data
use phasesmith_io::{PowderFormat, PowderReadLimits, parse_powder_text};
let data = parse_powder_text(
"20.0 100.0 2.0\n20.1 120.0 2.5\n",
PowderFormat::Columns,
1,
PowderReadLimits::default(),
)?;
assert_eq!(data.pattern.sample_count(), 2);read_powder_file and parse_powder_text support plain columns and
selected GSAS formats. read_cif_file and parse_cif_text implement the
native CIF path with structured diagnostics. Space-group lookup functions
expose database provenance and do not require a CIF parser.
Keep default limits for ordinary trusted files; tighten them when accepting untrusted uploads. Limit errors are distinct from syntax and domain errors.
Structs§
- CifAnisotropic
Displacement - Fixed anisotropic displacement attached to one site.
- CifAtom
Site - One independent atom site imported from CIF.
- CifDiagnostic
- One stable CIF import diagnostic.
- CifRead
Limits - Resource limits checked before and during CIF parsing.
- CifRead
Result - One selected CIF structure plus block-selection context.
- CifStructure
- Parser-independent native crystallographic structure.
- CifStructure
Source - Source provenance retained after CIF parsing.
- Gsas
TofInstrument Data - One translated legacy GSAS TOF bank plus source metadata.
- Gsas
TofInstrument Read Limits - Resource limit checked before decoding a legacy instrument file.
- Powder
Data - One observed powder dataset plus source metadata.
- Powder
Read Limits - Resource limits checked before or during parsing.
- Space
Group Database Provenance - Reviewed source and version for native space-group lookup data.
- Space
Group Info - Human identifiers plus an exact engine-owned conventional operation set.
- TofPowder
Data - One observed TOF powder dataset with an explicitly microsecond-domain axis.
Enums§
- CifDiagnostic
Severity - Stable diagnostic severity.
- CifIo
Error - Native CIF syntax, limit, lookup, or domain failure.
- Displacement
Convention - Original CIF displacement convention.
- Gsas
TofInstrument IoError - Stable failure categories for legacy GSAS TOF instrument import.
- Powder
Format - Caller-selected or detected powder text format.
- Powder
IoError - Native powder input failure with stable categories.
- Space
Group Lookup Error - Native space-group lookup or database-conversion failure.
- TofPowder
Format - Caller-selected or detected microsecond-domain powder text format.
Constants§
- NATIVE_
CIF_ BACKEND - Native CIF parser implementation identifier.
- NATIVE_
CIF_ BACKEND_ VERSION - Version of the native CIF adapter contract.
- SPACE_
GROUP_ DATABASE_ PROVENANCE - Provenance for the pure-Rust conventional space-group database.
Functions§
- parse_
cif_ text - Parse bounded UTF-8 CIF text into one selected native structure.
- parse_
gsas_ tof_ instrument_ text - Parse one bounded legacy GSAS TOF profile-function-1 or -3 bank from text.
- parse_
powder_ text - Parse bounded UTF-8 powder text without filesystem access.
- parse_
tof_ powder_ text - Parse one bounded reduced TOF input into bin-center intensity densities.
- parse_
tof_ powder_ text_ as - Parse bounded microsecond-domain powder text with an explicit convention.
- read_
cif_ file - Read and parse one bounded UTF-8 CIF file.
- read_
gsas_ tof_ instrument_ file - Read one bounded legacy GSAS TOF profile-function-1 or -3 bank.
- read_
powder_ file - Read and parse one bounded UTF-8 powder file.
- read_
tof_ powder_ file - Read one bounded reduced TOF file into bin-center intensity densities.
- read_
tof_ powder_ file_ as - Read one bounded microsecond-domain powder file with an explicit convention.
- space_
group_ by_ hall_ symbol - Resolve an exact Hall symbol, preserving its setting and origin choice.
- space_
group_ by_ number - Resolve an International Tables number in the conventional standard setting.
- space_
group_ by_ symbol - Resolve a Hermann–Mauguin, full-setting, or Hall symbol.