ModInfo

Struct ModInfo 

Source
pub struct ModInfo {
    pub name: String,
    pub version: Version,
    pub title: String,
    pub author: String,
    pub contact: Option<String>,
    pub homepage: Option<Url>,
    pub description: Option<String>,
    pub factorio_version: FactorioVersion,
    pub dependencies: Vec<Dependency>,
    pub package: Option<ModPackageInfo>,
}
Expand description

The info.json file identifies the mod and defines its version.

Fields§

§name: String

The internal name of mod.

The game accepts anything as a mod name, however the mod portal restricts mod names to only consist of alphanumeric characters, dashes and underscores. Note that the mod folder or mod zip file name has to contain the mod name, where the restrictions of the file system apply.

The game accepts mod names with a maximum length of 100 characters. The mod portal only accepts mods with names that are longer than 3 characters and shorter than 50 characters.

§version: Version

Defines the version of the mod.

§title: String

The display name of the mod, so it is not recommended to use someUgly_pRoGrAmMeR-name here.

Can be overwritten with a locale entry in the mod-name category, using the internal mod name as the key.

The game will reject a title field that is longer than 100 characters. However, this can be worked around by using the locale entry. The mod portal does not restrict mod title length.

§author: String

The author of the mod.

This field does not have restrictions, it can also be a list of authors etc. The mod portal ignores this field, it will simply display the uploader’s name as the author.

§contact: Option<String>

How the mod author can be contacted, for example an email address.

§homepage: Option<Url>

Where the mod can be found on the internet.

Note that the in-game mod browser shows the mod portal link additionally to this field. Please don’t put the string "None" here, it makes the field on the mod portal website look ugly. Just leave the field empty if the mod doesn’t have a website/forum thread/discord.

Note: The None variant is perfectly valid to use.

§description: Option<String>

A short description of what your mod does.

This is all that people get to see in-game. Can be overwritten with a locale entry in the mod-description category, using the internal mod name as the key.

§factorio_version: FactorioVersion

The Factorio version that this mod supports.

This can only be one Factorio version, not multiple. However, it includes all .sub (.patch) versions. While the field is optional, usually mods are developed for versions higher than the default 0.12, so the field has to be added anyway.

Adding a sub (patch) part, e.g. “0.18.27” will make the mod portal reject the mod and the game act weirdly. That means this shouldn’t be done; use only the major and minor components “major.minor”, for example “1.0”.

Mods with the factorio_version “0.18” can also be loaded in 1.0 and the mod portal will return them when queried for factorio_version 1.0 mods.

§dependencies: Vec<Dependency>

Mods that this mod depends on or is incompatible with.

If this mod depends on another, the other mod will load first, see Data-Lifecycle. An empty Vec allows to work around the default and have no dependencies at all.

§package: Option<ModPackageInfo>

Unofficial extensions to the info.json format.

Used by third party packaging tools (such as Facti).

Implementations§

Source§

impl ModInfo

Source

pub fn builder<T, U, V>( name: T, version: Version, title: U, author: V, ) -> ModInfoBuilder
where T: Into<String>, U: Into<String>, V: Into<String>,

Creates a builder to more conveniently construct a ModInfo struct.

Trait Implementations§

Source§

impl Clone for ModInfo

Source§

fn clone(&self) -> ModInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ModInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ModInfo

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ModInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ModInfo

Source§

fn eq(&self, other: &ModInfo) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ModInfo

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for ModInfo

Source§

impl StructuralPartialEq for ModInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,