Expand description
Functionality for user-defined types exported to the engine (native scripts).
NativeScript allows users to have their own scripts in a native language (in this case Rust). It is not the same as GDNative, the native interface to call into Godot. Symbols in this module allow registration, exporting and management of user-defined types which are wrapped in native scripts.
If you are looking for how to manage Godot core types or classes (objects), check
out the core_types
and object
modules, respectively.
To handle initialization and shutdown of godot-rust, take a look at the init
module.
For full examples, see examples
in the godot-rust repository.
Modules§
Macros§
- godot_
wrap_ method - Convenience macro to wrap an object’s method into a
Method
implementor that can be passed to the engine when registering a class.
Structs§
- ArgBuilder
- Builder for providing additional argument information for error reporting.
- Argument
Error - Error during argument parsing.
- Class
Builder - Allows registration of exported properties, methods and signals.
- Export
Info - Metadata about the exported property.
- Index
Bounds - Defines which number of arguments is valid.
- Method
Builder - Builder type used to register a method on a
NativeClass
. - Property
- Placeholder type for exported properties with no backing field.
- Property
Builder - Builder type used to register a property on a
NativeClass
. - Property
Usage - Signal
Builder - Class to construct a signal. Make sure to call
Self::done()
in the end. - Signal
Param - Parameter in a signal declaration.
- Static
Args - Adapter for methods whose arguments are statically determined. If the arguments would fail to
type check, the method will print the errors to Godot’s debug console and return
null
. - Varargs
- Safe interface to a list of borrowed method arguments with a convenient API for common operations with them.
Enums§
- RpcMode
- Varargs
Error - All possible errors that can occur when converting from Varargs.
Traits§
- Export
- Trait for exportable types.
- From
Varargs - Trait for structures that can be parsed from
Varargs
. - Method
- Safe low-level trait for stateful, variadic methods that can be called on a native script type.
- Mixin
- Trait for mixins, manually registered
#[methods]
blocks that may be applied to multiple types. - Native
Class - Trait used for describing and initializing a Godot script class.
- Native
Class Methods - Trait used to provide information of Godot-exposed methods of a script class.
- Owner
Arg - Trait for types that can be used as the
owner
arguments of exported methods. This trait is sealed and has no public interface. - Static
Args Method - Trait for methods whose argument lists are known at compile time. Not to be confused with a “static method”.
- Statically
Named - A NativeScript “class” that is statically named.
NativeClass
types that implement this trait can be registered using [InitHandle::add_class
].