pub struct Configuration {
entry_symbol: String,
compatibility_minimum: Option<f64>,
compatibility_maximum: Option<f64>,
reloadable: Option<bool>,
android_aar_plugin: Option<bool>,
}Expand description
Configuration section of the .gdextension file.
Fields§
§entry_symbol: StringName of the entry function for initializing the GDExtension. By default, its name is "gdext_rust_init", but it can be changed by using the attribute entry_point (godot-rust <= 0.2.0) or entry_symbol (>= 0.2.1).
§Examples
In lib.rs:
#[gdextension(entry_symbol = libmy_rust_init)]
unsafe impl ExtensionLibrary for MyExtension {}compatibility_minimum: Option<f64>Minimum compatible version of Godot. This prevents older versions of Godot from loading GDExtensions that depend on features from newer versions of Godot. It’s formatted as follows: <major>.<minor>.
compatibility_maximum: Option<f64>Maximum compatible version of Godot. This prevents newer versions of Godot from loading the GDExtension. It’s formatted as follows: <major>.<minor>.
reloadable: Option<bool>Whether or not to allow the reloading of the GDExtension upon recompilation. Supported only for Godot 4.2 and later. Meant generally for development and debug purposes, and it can fail, it always is safer to close and reopen the engine, but it’s a good quality of life feature in general.
android_aar_plugin: Option<bool>The GDExtension is part of a v2 Android plugin. During export this flag will indicate to the editor that the GDExtension native shared libraries are exported by the Android plugin AAR binaries.
Implementations§
Source§impl Configuration
impl Configuration
Sourcepub fn new(
entry_symbol: EntrySymbol,
compatibility_minimum: Option<(u8, u8)>,
compatibility_maximum: Option<(u8, u8)>,
is_reloadable: bool,
are_exported_by_android_aar_plugin: bool,
) -> Self
pub fn new( entry_symbol: EntrySymbol, compatibility_minimum: Option<(u8, u8)>, compatibility_maximum: Option<(u8, u8)>, is_reloadable: bool, are_exported_by_android_aar_plugin: bool, ) -> Self
Creates a new instance of Configuration, by using parameters with sensible types instead of the types Configuration will store.
§Parameters
entry_symbol-EntrySymbolfor initializing theGDExtension. It uses itsto_stringmethod to provide its representation.compatibility_minimum- Minimum compatible version ofGodot, with format(major, minor), in caseSomeis provided.compatibility_maximum- Maximum compatible version ofGodot, with format(major, minor), in caseSomeis provided.is_reloadable- Whether or not to allow the reloading of theGDExtensionupon recompilation.are_exported_by_android_aar_plugin- Whether or not theGDExtensionnative shared libraries are exported by theAndroidpluginAARbinaries.
§Returns
The Configuration with the necessary fields properly parsed.
Sourcepub fn raw_new(
entry_symbol: String,
compatibility_minimum: Option<f64>,
compatibility_maximum: Option<f64>,
reloadable: Option<bool>,
android_aar_plugin: Option<bool>,
) -> Self
pub fn raw_new( entry_symbol: String, compatibility_minimum: Option<f64>, compatibility_maximum: Option<f64>, reloadable: Option<bool>, android_aar_plugin: Option<bool>, ) -> Self
Creates a new instance of Configuration, by using the parameters as are.
§Parameters
entry_symbol- Name of the entry function for initializing theGDExtension.compatibility_minimum- Minimum compatible version ofGodot, with formatmajor.minor, in caseSomeis provided.compatibility_maximum- Maximum compatible version ofGodot, with formatmajor.minor, in caseSomeis provided.reloadable- Whether or not to allow the reloading of theGDExtensionupon recompilation, in caseSomeis provided.android_aar_plugin- Whether or not theGDExtensionnative shared libraries are exported by theAndroidpluginAARbinaries in caseSomeis provided.
§Returns
The Configuration with the necessary fields properly parsed.
Sourcepub fn from_entry_symbol(entry_symbol: EntrySymbol) -> Self
pub fn from_entry_symbol(entry_symbol: EntrySymbol) -> Self
Creates a new instance of Configuration, by using a specified EntrySymbol.
§Parameters
entry_symbol-EntrySymbolfor initializing theGDExtension. It uses itsto_stringmethod to provide its representation.
§Returns
The Configuration with the entry_symbol field properly parsed.
Sourcepub fn from_raw_entry_symbol(entry_symbol: String) -> Self
pub fn from_raw_entry_symbol(entry_symbol: String) -> Self
Creates a new instance of Configuration, by using a specified String as the empty symbol as is.
§Parameters
entry_symbol- Name of the entry function for initializing theGDExtension.
§Returns
The Configuration with the entry_symbol field properly parsed.
Sourcepub fn with_compatibility_minimum(self, compatibility_minimum: (u8, u8)) -> Self
pub fn with_compatibility_minimum(self, compatibility_minimum: (u8, u8)) -> Self
Sets the compatibility_minimum of the Configuration to the one passed as parameter properly parsed and returns it.
§Parameters
compatibility_minimum- Minimum compatible version ofGodot, with format(major, minor).
Sourcepub fn with_raw_compatibility_minimum(self, compatibility_minimum: f64) -> Self
pub fn with_raw_compatibility_minimum(self, compatibility_minimum: f64) -> Self
Sets the compatibility_minimum of the Configuration to the one passed as parameter and returns it.
§Parameters
compatibility_minimum- Minimum compatible version ofGodot, with formatmajor.minor.
Sourcepub fn with_compatibility_maximum(self, compatibility_maximum: (u8, u8)) -> Self
pub fn with_compatibility_maximum(self, compatibility_maximum: (u8, u8)) -> Self
Sets the compatibility_maximum of the Configuration to the one passed as parameter properly parsed and returns it.
§Parameters
compatibility_maximum- Maximum compatible version ofGodot, with format(major, minor).
Sourcepub fn with_raw_compatibility_maximum(self, compatibility_maximum: f64) -> Self
pub fn with_raw_compatibility_maximum(self, compatibility_maximum: f64) -> Self
Sets the compatibility_maximum of the Configuration to the one passed as parameter and returns it.
§Parameters
compatibility_maximum- Maximum compatible version ofGodot, with formatmajor.minor.
Sourcepub fn with_reloadability(self) -> Self
pub fn with_reloadability(self) -> Self
Changes the Configuration to allow the reloading of the GDExtension upon recompilation.
Sourcepub fn with_android_aar_plugin(self) -> Self
pub fn with_android_aar_plugin(self) -> Self
Changes the Configuration so the GDExtension native shared libraries are exported by the Android plugin AAR binaries and returns it.
Trait Implementations§
Source§impl Debug for Configuration
impl Debug for Configuration
Source§impl Default for Configuration
impl Default for Configuration
Source§fn default() -> Self
fn default() -> Self
The Configuration with the entry symbol found in the godot-rust book.