pub struct Spawnset<SpawnType> {
pub header: Header,
pub arena: Arena,
pub spawns_header: SpawnsHeader,
pub spawns: Vec<Spawn<SpawnType>>,
pub settings: Option<Settings>,
}Fields§
§header: Header§arena: Arena§spawns_header: SpawnsHeader§spawns: Vec<Spawn<SpawnType>>§settings: Option<Settings>Implementations§
Source§impl<SpawnType: Clone> Spawnset<SpawnType>
impl<SpawnType: Clone> Spawnset<SpawnType>
Sourcepub fn deserialize<R: Read>(source: &mut R) -> Result<Self>
pub fn deserialize<R: Read>(source: &mut R) -> Result<Self>
Examples found in repository?
examples/spawnset_examples.rs (line 8)
5fn main() -> anyhow::Result<()> {
6 let spawnset_file = std::env::args().nth(1).unwrap();
7 let mut spawnset_file = File::open(spawnset_file)?;
8 let spawnset = Spawnset::<V3Enemies>::deserialize(&mut spawnset_file)?;
9 println!("{:#?}", spawnset);
10 // use this commented line to have an actual file writer and comment the md5 comp
11 // let mut file_writer = BufWriter::new(File::create("spawnset_output")?);
12 let mut file_writer = Vec::new();
13 spawnset.serialize(&mut file_writer)?;
14 file_writer.flush()?;
15 println!("{:x}", md5::compute(&file_writer));
16 Ok(())
17}Sourcepub fn serialize<W: Write>(&self, sink: &mut W) -> Result<()>
pub fn serialize<W: Write>(&self, sink: &mut W) -> Result<()>
Examples found in repository?
examples/spawnset_examples.rs (line 13)
5fn main() -> anyhow::Result<()> {
6 let spawnset_file = std::env::args().nth(1).unwrap();
7 let mut spawnset_file = File::open(spawnset_file)?;
8 let spawnset = Spawnset::<V3Enemies>::deserialize(&mut spawnset_file)?;
9 println!("{:#?}", spawnset);
10 // use this commented line to have an actual file writer and comment the md5 comp
11 // let mut file_writer = BufWriter::new(File::create("spawnset_output")?);
12 let mut file_writer = Vec::new();
13 spawnset.serialize(&mut file_writer)?;
14 file_writer.flush()?;
15 println!("{:x}", md5::compute(&file_writer));
16 Ok(())
17}pub fn recalculate_spawn_count(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl<SpawnType> Freeze for Spawnset<SpawnType>
impl<SpawnType> RefUnwindSafe for Spawnset<SpawnType>where
SpawnType: RefUnwindSafe,
impl<SpawnType> Send for Spawnset<SpawnType>where
SpawnType: Send,
impl<SpawnType> Sync for Spawnset<SpawnType>where
SpawnType: Sync,
impl<SpawnType> Unpin for Spawnset<SpawnType>where
SpawnType: Unpin,
impl<SpawnType> UnwindSafe for Spawnset<SpawnType>where
SpawnType: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more