Skip to main content

FeffCodec

Trait FeffCodec 

Source
pub trait FeffCodec: Sized {
    const FORMAT: FileFormat;

    // Required methods
    fn decode(path: &Path, bytes: &[u8]) -> Result<Self>;
    fn encode(&self) -> Result<Vec<u8>>;

    // Provided methods
    fn read_from(path: &Path, source: impl Read) -> Result<Self> { ... }
    fn write_to(&self, path: &Path, destination: impl Write) -> Result<()> { ... }
}
Expand description

Codec implemented by typed FEFF input/output models.

Required Associated Constants§

Source

const FORMAT: FileFormat

Registered format represented by this type.

Required Methods§

Source

fn decode(path: &Path, bytes: &[u8]) -> Result<Self>

Decode a complete file payload.

Source

fn encode(&self) -> Result<Vec<u8>>

Encode a complete canonical file payload.

Provided Methods§

Source

fn read_from(path: &Path, source: impl Read) -> Result<Self>

Read a stream and decode it with a caller-supplied source path.

Source

fn write_to(&self, path: &Path, destination: impl Write) -> Result<()>

Write a canonical payload, preserving destination context on errors.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl FeffCodec for ChemicalDatData

Source§

const FORMAT: FileFormat = FileFormat::ChemicalDat

Source§

impl FeffCodec for ChiDatData

Source§

const FORMAT: FileFormat = FileFormat::ChiDat

Source§

impl FeffCodec for ChiaBinData

Source§

const FORMAT: FileFormat = FileFormat::ChiaBin

Source§

impl FeffCodec for EmeshBinData

Source§

const FORMAT: FileFormat = FileFormat::EmeshBin

Source§

impl FeffCodec for FeffBinData

Source§

const FORMAT: FileFormat = FileFormat::FeffBin

Source§

impl FeffCodec for FmsBinData

Source§

const FORMAT: FileFormat = FileFormat::FmsBin

Source§

impl FeffCodec for GgDatData

Source§

const FORMAT: FileFormat = FileFormat::GgBin

Source§

impl FeffCodec for GtrBinData

Source§

const FORMAT: FileFormat = FileFormat::GtrBin

Source§

impl FeffCodec for PhaseBinData

Source§

const FORMAT: FileFormat = FileFormat::PhaseBin

Source§

impl FeffCodec for PotBinData

Source§

const FORMAT: FileFormat = FileFormat::PotBin

Source§

impl FeffCodec for SfconvSpecfunctData

Source§

const FORMAT: FileFormat = FileFormat::SpecfunctDat

Source§

impl FeffCodec for XmuDatData

Source§

const FORMAT: FileFormat = FileFormat::XmuDat

Source§

impl FeffCodec for XsectDatData

Source§

const FORMAT: FileFormat = FileFormat::XsectDat