[][src]Struct genie_cpx::CampaignWriter

pub struct CampaignWriter<W: Write> { /* fields omitted */ }

A campaign file writer. Instantiate it, then add scenario files to it.

This has to keep all scenario files in memory until the file is written, either on a call to flush() or implicitly when the struct is dropped.

Implementations

impl<W: Write> CampaignWriter<W>[src]

pub fn new(name: &str, writer: W) -> Self[src]

Create a new campaign with user-visible name name, writing to the writer stream.

pub fn version(self, version: CPXVersion) -> Self[src]

Set the file version to output.

pub fn add_raw(&mut self, name: &str, filename: &str, scx: Vec<u8>)[src]

Add a scenario (as a byte array) to this campaign.

pub fn add(&mut self, name: &str, scx: &Scenario) -> SCXResult<()>[src]

Add a Scenario instance from genie-scx to this campaign.

This returns a Result because it serializes the scenario to an in-memory byte array, which may fail.

pub fn into_inner(self) -> W[src]

Consume the CampaignWriter instance, returning the inner Write instance.

pub fn flush(self) -> Result<W>[src]

Write the scenarios to the output stream, consuming the CampaignWriter object.

Returns the inner Write.

Auto Trait Implementations

impl<W> RefUnwindSafe for CampaignWriter<W> where
    W: RefUnwindSafe

impl<W> Send for CampaignWriter<W> where
    W: Send

impl<W> Sync for CampaignWriter<W> where
    W: Sync

impl<W> Unpin for CampaignWriter<W> where
    W: Unpin

impl<W> UnwindSafe for CampaignWriter<W> where
    W: UnwindSafe

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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.