Skip to main content

pe_assembler/formats/dll/writer/
mod.rs

1//! DLL 文件写入器模块
2//!
3//! 此模块提供将 PE 结构体写入 DLL 二进制文件的功能,与 reader 模块相对应。
4
5use std::io::{Seek, Write};
6
7use crate::helpers::PeWriter;
8
9/// DLL 文件写入器
10#[derive(Debug)]
11pub struct DllWriter<W> {
12    writer: W,
13}
14
15impl<W> DllWriter<W> {
16    /// 创建新的 DLL 写入器
17    pub fn new(writer: W) -> Self {
18        Self { writer }
19    }
20
21    /// 完成写入并返回底层写入器
22    pub fn finish(self) -> W {
23        self.writer
24    }
25}
26
27impl<W: Write + Seek> PeWriter<W> for DllWriter<W> {
28    fn get_writer(&mut self) -> &mut W {
29        &mut self.writer
30    }
31}