[][src]Struct genie::DRSWriter

pub struct DRSWriter<W> where
    W: Write + Seek
{ /* fields omitted */ }

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]

pub fn new<impl Strategy + 'static>(
    output: W,
    strategy: impl Strategy + 'static
) -> Result<DRSWriter<W>, Error> where
    impl Strategy + 'static: 'static + Strategy<W>, 
[src]

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]

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> Unpin for DRSWriter<W> where
    W: Unpin

impl<W> !Send for DRSWriter<W>

impl<W> !UnwindSafe for DRSWriter<W>

impl<W> !RefUnwindSafe for DRSWriter<W>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]