pub fn read_twoda_auto<R: Read>(
reader: &mut R,
name_or_extension: &str,
) -> Result<TwoDa, TwoDaBinaryError>Expand description
Auto-detects the format from file extension and reads accordingly.
Supported extensions (case-insensitive):
.2da,.bif,.mod,.erf,.rim(or unknown) -> binary 2DA.csv-> CSV format.json-> JSON format
ยงErrors
Whatever the format it dispatches to reports. Without the serde feature,
.csv and .json are TwoDaBinaryError::InvalidTable saying the
feature is needed, rather than falling through to the binary reader.
An unrecognised extension is read as binary rather than refused, so a name that names no format fails as a bad 2DA rather than as a bad name.