Configuration

Struct Configuration 

Source
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: String

Name 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

Source

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 - EntrySymbol for initializing the GDExtension. It uses its to_string method to provide its representation.
  • compatibility_minimum - Minimum compatible version of Godot, with format (major, minor), in case Some is provided.
  • compatibility_maximum - Maximum compatible version of Godot, with format (major, minor), in case Some is provided.
  • is_reloadable - Whether or not to allow the reloading of the GDExtension upon recompilation.
  • are_exported_by_android_aar_plugin - Whether or not the GDExtension native shared libraries are exported by the Android plugin AAR binaries.
§Returns

The Configuration with the necessary fields properly parsed.

Source

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 the GDExtension.
  • compatibility_minimum - Minimum compatible version of Godot, with format major.minor, in case Some is provided.
  • compatibility_maximum - Maximum compatible version of Godot, with format major.minor, in case Some is provided.
  • reloadable - Whether or not to allow the reloading of the GDExtension upon recompilation, in case Some is provided.
  • android_aar_plugin - Whether or not the GDExtension native shared libraries are exported by the Android plugin AAR binaries in case Some is provided.
§Returns

The Configuration with the necessary fields properly parsed.

Source

pub fn from_entry_symbol(entry_symbol: EntrySymbol) -> Self

Creates a new instance of Configuration, by using a specified EntrySymbol.

§Parameters
  • entry_symbol - EntrySymbol for initializing the GDExtension. It uses its to_string method to provide its representation.
§Returns

The Configuration with the entry_symbol field properly parsed.

Source

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 the GDExtension.
§Returns

The Configuration with the entry_symbol field properly parsed.

Source

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 of Godot, with format (major, minor).
Source

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 of Godot, with format major.minor.
Source

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 of Godot, with format (major, minor).
Source

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 of Godot, with format major.minor.
Source

pub fn with_reloadability(self) -> Self

Changes the Configuration to allow the reloading of the GDExtension upon recompilation.

Source

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

Source§

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

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

impl Default for Configuration

Source§

fn default() -> Self

The Configuration with the entry symbol found in the godot-rust book.

Source§

impl<'de> Deserialize<'de> for Configuration

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 Serialize for Configuration

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

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> 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, 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>,