pub struct SignalBuilder<'a, C> { /* private fields */ }
Expand description

Class to construct a signal. Make sure to call Self::done() in the end.

Signal parameters can be added with the various param*() methods. Keep in mind that unlike function parameters, signal parameters (both their lengths and types) are not statically checked in Godot. The parameter signature you specify is simply to assist you in the editor UI and with auto-generation of GDScript signal handlers.

Implementations§

source§

impl<'a, C: NativeClass> SignalBuilder<'a, C>

source

pub fn with_param(self, parameter_name: &str, parameter_type: VariantType) -> Self

Add a parameter for the signal with a name and type.

Note that GDScript signal parameters are generally untyped and not checked at runtime. The type is solely used for UI purposes.

source

pub fn with_param_default(
    self,
    parameter_name: &str,
    default_value: Variant
) -> Self

Add a parameter for the signal with a name and default value.

The type is inferred from the default value. Note that GDScript signal parameters are generally untyped and not checked at runtime. The type is solely used for UI purposes.

source

pub fn with_param_untyped(self, parameter_name: &str) -> Self

Add a (untyped) parameter for the signal with a name.

Types are not required or checked at runtime, but they help for editor UI and auto-generation of signal listeners.

source

pub fn with_param_custom(self, parameter: SignalParam) -> Self

Add a parameter for the signal, manually configured.

source

pub fn done(self)

Finish registering the signal.

Auto Trait Implementations§

§

impl<'a, C> !RefUnwindSafe for SignalBuilder<'a, C>

§

impl<'a, C> !Send for SignalBuilder<'a, C>

§

impl<'a, C> !Sync for SignalBuilder<'a, C>

§

impl<'a, C> Unpin for SignalBuilder<'a, C>

§

impl<'a, C> !UnwindSafe for SignalBuilder<'a, C>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.