[−][src]Struct genie::Campaign
A campaign file containing scenario files.
Implementations
impl<R> Campaign<R> where
R: Read + Seek,
[src]
R: Read + Seek,
pub fn from(input: R) -> Result<Campaign<R>, ReadCampaignError>
[src]
Create a campaign instance from a readable input.
This immediately reads the campaign header and scenario metadata, but not the scenario files themselves.
pub fn into_inner(self) -> R
[src]
Consume this Campaign instance and get the reader.
pub fn version(&self) -> [u8; 4]
[src]
Get the campaign file version.
pub fn name(&self) -> &str
[src]
Get the user-facing name of this campaign.
pub fn entries(&self) -> impl Iterator<Item = &ScenarioMeta>
[src]
Iterate over the scenario metadata for this campaign.
pub fn len(&self) -> usize
[src]
Get the number of scenarios in this campaign.
pub fn is_empty(&self) -> bool
[src]
Returns true if this campaign contains no scenario files.
pub fn get_name(&self, id: usize) -> Option<&str>
[src]
Get the user-facing name of the scenario at the given index.
pub fn get_filename(&self, id: usize) -> Option<&str>
[src]
Get the filename of the scenario at the given index.
pub fn by_name(&mut self, filename: &str) -> Result<Scenario, ReadCampaignError>
[src]
Get a scenario by its file name.
pub fn by_index(&mut self, index: usize) -> Result<Scenario, ReadCampaignError>
[src]
Get a scenario by its campaign index.
pub fn by_name_raw(
&mut self,
filename: &str
) -> Result<Vec<u8>, ReadCampaignError>
[src]
&mut self,
filename: &str
) -> Result<Vec<u8>, ReadCampaignError>
Get a scenario file buffer by its file name.
pub fn by_index_raw(
&mut self,
index: usize
) -> Result<Vec<u8>, ReadCampaignError>
[src]
&mut self,
index: usize
) -> Result<Vec<u8>, ReadCampaignError>
Get a scenario file buffer by its campaign index.
impl<R> Campaign<R> where
R: Read + Seek,
[src]
R: Read + Seek,
pub fn write_to<W>(&mut self, output: &mut W) -> Result<(), WriteCampaignError> where
W: Write,
[src]
W: Write,
Write the scenario file to an output stream, using the same version as when reading it.
pub fn write_to_version<W>(
&mut self,
output: &mut W,
version: [u8; 4]
) -> Result<(), WriteCampaignError> where
W: Write,
[src]
&mut self,
output: &mut W,
version: [u8; 4]
) -> Result<(), WriteCampaignError> where
W: Write,
Write the scenario file to an output stream with the given version.
Trait Implementations
impl<R> Clone for Campaign<R> where
R: Clone + Read + Seek,
[src]
R: Clone + Read + Seek,
impl<R> Debug for Campaign<R> where
R: Debug + Read + Seek,
[src]
R: Debug + Read + Seek,
Auto Trait Implementations
impl<R> RefUnwindSafe for Campaign<R> where
R: RefUnwindSafe,
R: RefUnwindSafe,
impl<R> Send for Campaign<R> where
R: Send,
R: Send,
impl<R> Sync for Campaign<R> where
R: Sync,
R: Sync,
impl<R> Unpin for Campaign<R> where
R: Unpin,
R: Unpin,
impl<R> UnwindSafe for Campaign<R> where
R: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,