pub struct FactorioExporter<'a> { /* private fields */ }
Expand description
Main class for orchestrating the export.
Implementations§
Source§impl FactorioExporter<'_>
impl FactorioExporter<'_>
Sourcepub fn new<'a>(
factorio_binary: &'a Path,
api: &'a Api,
locale: &'a str,
export_icons: bool,
) -> Result<FactorioExporter<'a>>
pub fn new<'a>( factorio_binary: &'a Path, api: &'a Api, locale: &'a str, export_icons: bool, ) -> Result<FactorioExporter<'a>>
Creates and configures a new FactorioExporter
instance.
§Arguments
factorio_binary
- File system path of a Factorio binary. This can be any variant of the binary, full, headless, or demo.api
- The definition of the Factorio API, as loaded byload_api
.locale
- Locale code to use for translated strings.export_icons
- Whether icon paths should be collected in the data phase and patched into the prototype definitions using a heuristic.
Source§impl FactorioExporter<'_>
impl FactorioExporter<'_>
Sourcepub fn export(&self) -> Result<Value>
pub fn export(&self) -> Result<Value>
Export the prototype definitions from Factorio and partially deserialize
them into a serde_yaml::Value
object, which can easily deserialized
of serialized into other data types further.
This function executes Factorio twice, once to create a save file, and a second time to execute an exporter mod that does the heavy-lifting. The process uses a temporary directory, so that the main Factorio installation is not touched. Any existing Factorio configuration, including installed mods are therefore ignored.
Sourcepub fn install_mods<I, P>(&self, mods: I) -> Result<()>
pub fn install_mods<I, P>(&self, mods: I) -> Result<()>
Install mods into the temporary execution directory before exporting. This allows exporting additional items, recipes, and all other changes that the mods make to be part of the export.
No particular checks are made that the dependencies of the specified mods can be resolved. This is the responsibility of the caller. Otherwise Factorio will probably not start.
§Arguments
mods
- A list of file system paths that point to Factorio mods in.zip
format.
Auto Trait Implementations§
impl<'a> Freeze for FactorioExporter<'a>
impl<'a> RefUnwindSafe for FactorioExporter<'a>
impl<'a> Send for FactorioExporter<'a>
impl<'a> Sync for FactorioExporter<'a>
impl<'a> Unpin for FactorioExporter<'a>
impl<'a> UnwindSafe for FactorioExporter<'a>
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
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>
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>
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