pe-assembler 0.1.1

PE/COFF assembler for Windows instruction sets - strongly typed, object-oriented, zero-dependency core
Documentation
//! EXE file writer module
//!
//! This module provides the functionality to write PE structures to EXE binary files,
//! corresponding to the reader module.

use std::io::{Seek, Write};

use crate::helpers::PeWriter;

/// EXE file writer
#[derive(Debug)]
pub struct ExeWriter<W> {
    writer: W,
}

impl<W> ExeWriter<W> {
    /// Create a new EXE writer
    pub fn new(writer: W) -> Self {
        Self { writer }
    }

    /// Finish writing and return the underlying writer
    pub fn finish(self) -> W {
        self.writer
    }
}

impl<W: Write + Seek> PeWriter<W> for ExeWriter<W> {
    fn get_writer(&mut self) -> &mut W {
        &mut self.writer
    }
}