[−][src]Struct genie::DRSWriter
Generator for .drs archives.
use std::{io::Cursor, fs::File}; use genie_drs::{DRSWriter, InMemoryStrategy}; let buf = Cursor::new(vec![]); let mut writer = DRSWriter::new(buf, InMemoryStrategy::default())?; writer.add("bina", 50500, "JASC-PAL\r\n0100\r\n...".as_bytes())?; writer.add("slp", 2, &b"some bytes"[..])?; let buf = writer.flush()?; // → a Vec<u8> containing the DRS file
Methods
impl<W> DRSWriter<W> where
W: Write + Seek,
[src]
W: Write + Seek,
pub fn new<impl Strategy + 'static>(
output: W,
strategy: impl Strategy + 'static
) -> Result<DRSWriter<W>, Error> where
impl Strategy + 'static: 'static + Strategy<W>,
[src]
output: W,
strategy: impl Strategy
) -> Result<DRSWriter<W>, Error> where
impl Strategy
Create a writer with the given strategy.
pub fn add<impl Into, impl Read>(
&mut self,
t: impl Into,
id: u32,
data: impl Read
) -> Result<(), Error> where
impl Into: Into<ResourceType>,
impl Read: Read,
[src]
&mut self,
t: impl Into
id: u32,
data: impl Read
) -> Result<(), Error> where
impl Into
impl Read: Read,
Add a file to the archive.
pub fn flush(self) -> Result<W, Error>
[src]
Finish any writes that still need to happen and return the file handle.
Auto Trait Implementations
impl<W> !Sync for DRSWriter<W>
impl<W> !Send for DRSWriter<W>
impl<W> Unpin for DRSWriter<W> where
W: Unpin,
W: Unpin,
impl<W> !RefUnwindSafe for DRSWriter<W>
impl<W> !UnwindSafe for DRSWriter<W>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,