class
Godot::TypedSignal(*T)
Overview
Strongly-typed signal binding offering compile-time type safety and zero-allocation
dispatch via Lapis::Core::StaticSignalTable.
Defined in:
lapis/cs_extras/signal_operators.crlapis/extras/operators.cr
libgodot/signals/typed_signal.cr
Constructors
Instance Method Summary
- #+(proc : Proc(Array(Variant), R)) : self forall R
-
#+(proc : Proc(U0, R)) : self forall U0, R
Operator
#+for 1-argument typed Proc (supports exact types and downcasting via StaticSignalTable) -
#+(proc : Proc(U0, U1, R)) : self forall U0, U1, R
Operator
#+for 2-argument typed Proc (supports exact types and downcasting via StaticSignalTable) -
#+(proc : Proc(R)) : self forall R
Operator
#+syntactic sugar for 0-argument Proc (supportssig += ->handler) -
#+(sub : SignalSubscription) : self
Operator
#+syntactic sugar accepting a SignalSubscription directly -
#-(proc : Proc) : self
Operator
#-syntactic sugar for disconnecting a Proc (supportssig -= ->handler) -
#-(sub : SignalSubscription) : self
Operator
#-syntactic sugar for disconnecting a SignalSubscription (supportssig -= sub) -
#<<(&block : *T -> Void) : SignalSubscription
Operator
<<syntactic sugar for type-safe connect with a block -
#<<(proc : Proc(*T, R)) : SignalSubscription forall R
Operator
<<syntactic sugar for type-safe connect with a Proc -
#<<(proc : Proc(R)) : SignalSubscription forall R
Operator
<<syntactic sugar for 0-argument Proc -
#>(target_signal : TypedSignal(*T)) : SignalSubscription
Strict pipe (>): Exact signature match required at compile-time!
-
#>(proc : Proc(*T, R)) : SignalSubscription forall R
Strict pipe (>): Exact signature match required at compile-time; binds directly to StaticSignalTable without wrapper closure.
-
#>>(target_signal : TypedSignal(*U)) : SignalSubscription forall U
Loose / adaptive pipe (>>): Accepts ANY TypedSignal(*U)!
-
#>>(proc : Proc(Array(Variant), R)) : SignalSubscription forall R
Loose pipe (>>) to a Proc accepting raw Variant array
-
#>>(proc : Proc(*U, R)) : SignalSubscription forall U, R
Loose / adaptive pipe (>>) to any N-argument Proc(*U, R): - If T == U: binds directly to StaticSignalTable via
bind(proc). -
#>>(target_signal : BoundSignal) : SignalSubscription
Loose pipe (>>) to a dynamic BoundSignal:
-
#await(timeout_sec : Float64 | Nil = nil)
Cooperatively awaits this signal without blocking the engine main loop.
-
#await(timeout_sec : Number)
Cooperatively awaits this signal with timeout in seconds
-
#await!(timeout_sec : Float64 | Nil = nil)
Cooperatively awaits this signal, returning the unwrapped value, or raising
Godot::DisposedObjectErrorif the target is freed, orGodot::TimeoutErroriftimeout_secexpires. - #await!(timeout_sec : Number)
-
#await?(timeout_sec : Float64 | Nil = nil)
Cooperatively awaits this signal, returning the value or nil if
timeout_secexpires or the target is freed. - #await?(timeout_sec : Number)
-
#bind(proc : Proc(*T, R), flags : ConnectFlags = ConnectFlags::None, once : Bool = false, receiver : Godot::Object | Nil = nil) : SignalSubscription forall R
Binds a pre-constructed
Proc(*T, R)directly to the underlyingStaticSignalTableslot without intermediate closure wrapping on the typed fast path. - #bind(once : Bool = false, flags : ConnectFlags = ConnectFlags::None, receiver : Godot::Object | Nil = nil, &block : *T -> Void) : SignalSubscription
-
#bind_slot(proc : Proc(*T, R), once : Bool = false) : UInt64 forall R
Binds a compile-time typed
Proc(*T, R)directly to theStaticSignalTableslot without allocating aSignalSubscription, returning the 64-bit slot token. -
#bind_slot(once : Bool = false, &block : *T -> Void) : UInt64
Binds a typed block directly to the
StaticSignalTableslot, returning the 64-bit slot token. -
#connect(flags : ConnectFlags = ConnectFlags::None, receiver : Godot::Object | Nil = nil, &block : *T -> Void) : SignalSubscription
Type-safe connect binding directly to
StaticSignalTablefor zero-allocation emission, while maintaining a synchronizedSignalSubscriptionfor lifecycle and dynamic fallback. -
#connect(receiver : Godot::Object, flags : ConnectFlags = ConnectFlags::None, &block : *T -> Void) : SignalSubscription
Overload allowing receiver as first positional argument: `sig.connect(receiver) { |args| ...
-
#connect_one_shot(&block : *T -> Void) : SignalSubscription
Backwards-compatibility helper redirecting to ConnectFlags::OneShot
-
#emit(*args : *T) : self
Emits this typed signal with strictly ZERO GC heap allocations on the typed hot path.
-
#once(&block : *T -> Void) : SignalSubscription
Idiomatic shorthand alias for
#connect_one_shot - #signal_hash : UInt64
-
#static_slot : Lapis::Core::StaticSignalSlot(*T)
Returns the zero-allocation
Lapis::Core::StaticSignalSlot(*T)backing this signal. -
#unbind(proc : Proc(*T, R)) : Bool forall R
Unbinds a typed
Proc(*T, R)from this signal. -
#unbind(token : UInt64) : Bool
Unbinds a listener by its 64-bit
StaticSignalTabletoken.
Instance methods inherited from class Godot::BoundSignal
+(proc : Proc(Array(Variant), R)) : self forall R+(proc : Proc(T, R)) : self forall T, R
+(proc : Proc(T0, T1, R)) : self forall T0, T1, R
+(proc : Proc(R)) : self forall R
+(sub : SignalSubscription) : self +, -(proc : Proc) : self
-(sub : SignalSubscription) : self -, <<(&block : Array(Variant) -> Void) : SignalSubscription
<<(proc : Proc(Array(Variant), R)) : SignalSubscription forall R
<<(proc : Proc(R)) : SignalSubscription forall R <<, >(proc : Proc(Array(Variant), R)) : SignalSubscription forall R
>(proc : Proc(R)) : SignalSubscription forall R
>(target_signal : BoundSignal) : SignalSubscription >, >>(target_signal : TypedSignal(*U)) : SignalSubscription forall U
>>(proc : Proc(Array(Variant), R)) : SignalSubscription forall R
>>(proc : Proc(*U, R)) : SignalSubscription forall U, R
>>(target_signal : BoundSignal) : SignalSubscription
>>(receiver_method : Tuple(Godot::Object, String | Symbol)) : SignalSubscription >>, active? : Bool active?, alive? : Bool alive?, await(timeout_sec : Float64 | Nil = nil) : AwaitStatus(Array(Variant))
await(timeout_sec : Number) : AwaitStatus(Array(Variant)) await, await!(timeout_sec : Float64 | Nil = nil) : Array(Variant)
await!(timeout_sec : Number) : Array(Variant) await!, await?(timeout_sec : Float64 | Nil = nil) : Array(Variant) | Nil
await?(timeout_sec : Number) : Array(Variant) | Nil await?, clear : self clear, connect(flags : ConnectFlags = ConnectFlags::None, callback : Proc(Array(Variant), Void) | Nil = nil, receiver : Godot::Object | Nil = nil) : SignalSubscription
connect(flags : ConnectFlags = ConnectFlags::None, receiver : Godot::Object | Nil = nil, &block : Array(Variant) -> Void) : SignalSubscription
connect(receiver : Godot::Object, flags : ConnectFlags = ConnectFlags::None, &block : Array(Variant) -> Void) : SignalSubscription
connect(type0 : T0.class, flags : ConnectFlags = ConnectFlags::None, &block : T0 -> Void) : SignalSubscription forall T0
connect(type0 : T0.class, type1 : T1.class, flags : ConnectFlags = ConnectFlags::None, &block : T0, T1 -> Void) : SignalSubscription forall T0, T1
connect(listener_target : Godot::Object, method_name : Symbol, flags : ConnectFlags = ConnectFlags::None) : SignalSubscription connect, connect_one_shot(&block : Array(Variant) -> Void) : SignalSubscription connect_one_shot, connected? : Bool connected?, connection_count : Int32 connection_count, disconnect : self disconnect, disconnect_all : self disconnect_all, emit(*args) : self emit, has_connections? : Bool has_connections?, name : String name, once(type0 : T0.class, type1 : T1.class, &block : T0, T1 -> Void) : SignalSubscription forall T0, T1
once(type0 : T0.class, &block : T0 -> Void) : SignalSubscription forall T0
once(&block : Array(Variant) -> Void) : SignalSubscription once, pipe_to(target_signal : BoundSignal, strict : Bool = false) : SignalSubscription pipe_to, target : Godot::Object target, target_id : UInt64 target_id, to_s(io : IO) : Void to_s
Constructor methods inherited from class Godot::BoundSignal
new(target : Godot::Object, name : String)
new
Instance methods inherited from class Object
try?(&)try? try?
Constructor Detail
Instance Method Detail
Operator #+ for 1-argument typed Proc (supports exact types and downcasting via StaticSignalTable)
Operator #+ for 2-argument typed Proc (supports exact types and downcasting via StaticSignalTable)
Operator #+ syntactic sugar for 0-argument Proc (supports sig += ->handler)
Operator #- syntactic sugar for disconnecting a Proc (supports sig -= ->handler)
Operator << syntactic sugar for type-safe connect with a block
Operator << syntactic sugar for type-safe connect with a Proc
Operator << syntactic sugar for 0-argument Proc
Strict pipe (>): Exact signature match required at compile-time!
Strict pipe (>): Exact signature match required at compile-time; binds directly to StaticSignalTable without wrapper closure.
Loose / adaptive pipe (>>): Accepts ANY TypedSignal(*U)!
Loose pipe (>>) to a Proc accepting raw Variant array
Loose / adaptive pipe (>>) to any N-argument Proc(*U, R):
- If T == U: binds directly to StaticSignalTable via
bind(proc). - If T.size >= U.size: connects via
TypedSignal#connect(StaticSignalTable fast path) with arity trimming and polymorphic downcasting.
Loose pipe (>>) to a dynamic BoundSignal:
Cooperatively awaits this signal without blocking the engine main loop. Returns an AwaitStatus(Array(Variant)) indicating completion or timeout.
Cooperatively awaits this signal with timeout in seconds
Cooperatively awaits this signal, returning the unwrapped value,
or raising Godot::DisposedObjectError if the target is freed,
or Godot::TimeoutError if timeout_sec expires.
Cooperatively awaits this signal, returning the value or nil if timeout_sec expires or the target is freed.
For 0-argument signals, returns true if completed, false if timed out, or nil if the target is freed.
Binds a pre-constructed Proc(*T, R) directly to the underlying StaticSignalTable slot
without intermediate closure wrapping on the typed fast path.
Binds a compile-time typed Proc(*T, R) directly to the StaticSignalTable slot
without allocating a SignalSubscription, returning the 64-bit slot token.
Type-safe connect binding directly to StaticSignalTable for zero-allocation emission,
while maintaining a synchronized SignalSubscription for lifecycle and dynamic fallback.
Overload allowing receiver as first positional argument: sig.connect(receiver) { |args| ... }
Backwards-compatibility helper redirecting to ConnectFlags::OneShot
Emits this typed signal with strictly ZERO GC heap allocations on the typed hot path.