struct
Lapis::Core::StaticSignalSlot(*T)
- Lapis::Core::StaticSignalSlot(*T)
- Struct
- Value
- Object
Overview
Stack-allocated, compile-time typed handle to a slot in StaticSignalTable.
Provides zero-allocation emission (#emit(*args : *T)) and direct binding
(#bind, #connect, #once, #+, #-).
Defined in:
lapis/core/static_signal_table.crConstructors
- .from_table(table : StaticSignalTable, emitter_id : UInt64, name : String, signal_hash : UInt64) : self
- .from_table(table : StaticSignalTable, emitter_id : UInt64, signal_hash : UInt64) : self
- .new(name : String = "signal", table : StaticSignalTable = StaticSignalTable.global, emitter_id : UInt64 = StaticSignalTable.next_anonymous_emitter_id)
Instance Method Summary
-
#+(callback : Proc(*T, R)) : self forall R
Compound operator
#+for subscribing a typedProc(*T, R). -
#-(callback : Proc(*T, R)) : self forall R
Compound operator
#-for unbinding a typedProc(*T, R). -
#active_count : Int32
Returns the number of active listeners bound to this slot.
-
#bind(callback : Proc(*T, R), once : Bool = false, subscription : Godot::SignalSubscription | Nil = nil, match_proc_pointer : Pointer(Void) = Pointer(Void).null, match_closure_data : Pointer(Void) = Pointer(Void).null) : UInt64 forall R
Binds a typed
Proc(*T, R)directly to this static signal slot. -
#bind(once : Bool = false, &block : *T -> Void) : UInt64
Block overload for
#binddelegating directly toStaticSignalTable#bind_by_hash. -
#clear! : Int32
Clears all listeners registered in this slot.
-
#connect(once : Bool = false, &block : *T -> Void) : UInt64
Connects a typed block to this static signal slot.
-
#connected? : Bool
Returns
trueif at least one listener is currently bound to this slot. -
#emission_count : UInt64
Returns the total number of emissions dispatched through this slot.
-
#emit(*args : *T) : Int32
Emits
*argsto all active listeners in this slot with zero GC heap allocations. - #emitter_id : UInt64
-
#empty? : Bool
Returns
trueif no listeners are currently bound to this slot. - #name : String
-
#once(&block : *T -> Void) : UInt64
Connects a one-shot typed block that automatically unbinds after its first invocation.
- #signal_hash : UInt64
- #table : StaticSignalTable
-
#unbind(callback : Proc(*T, R)) : Bool forall R
Unbinds the most recently registered listener matching
callback. -
#unbind(token : UInt64) : Bool
Unbinds a listener by its 64-bit token.
Instance methods inherited from class Object
try?(&)try? try?
Constructor Detail
Instance Method Detail
Binds a typed Proc(*T, R) directly to this static signal slot.
Connects a typed block to this static signal slot.
Emits *args to all active listeners in this slot with zero GC heap allocations.
Connects a one-shot typed block that automatically unbinds after its first invocation.
Unbinds the most recently registered listener matching callback.