Expand description
§signals2
signals2
is a thread-safe signal/slot library inspired by the boost::signals2
C++ library. Signals are objects that contain a list of callback functions (“slots”) to be executed when the signal is
“emitted”. Signals and their corresponding slots can be managed through the use of connections
and shared connection blocks.
signals2
contains no unsafe code and compiles on stable Rust 1.53.
signals2
is distributed under the Boost Software License, Version 1.0.
§Links
Modules§
- combiner
- Defines the combiner trait and several simple combiners that can be used.
- connect
- Defines different
connect
traits for signals. - emit
- Defines different
emit
traits for signals.
Structs§
- Connect
Handle - A handle to a signal that allows new slots to be connected to the underlying signal.
Useful in cases where it is undesireable to allow unresitriced access to a signal while
still allowing new slots to be connected. Internally, a
ConnectHandle
uses a WeakSignal. If the underlying signal no longer exists,connect
will return a connection that is in a disconnected state. - Emit
Handle - A handle to a signal that allows the signal to be emitted. Useful in cases where it is
undesireable to allow unresitriced access to a signal while still allowing the signal to be
emitted. Internally, an
EmitHandle
uses a WeakSignal. The result of callingemit
on anEmitHandle
is anOption<C::Output>
whereC
is the combiner type of the signal. If the underlying signal no longer exists,None
is returned. - Shared
Connection Block - A shared connection block can be used to temporarily block a slot from executing. There can be an arbitrary number of shared connection blocks for any particular slot. If any of the shared connection blocks are blocking the slot, that slot will not be executed when the signal is emitted.
- Signal
- A handle to a signal with a slot function signature of
Args -> R
.C
defines the combiner used to generate a return value whenemit
is envoked.G
defines the ordering of groups of slots. Arguments given to the signal must implementClone
. If you need to emit a signal with an argument that doesn’t implement clone, that argument should be wrapped in anArc<T>
(as an example) to make it cloneable. - Weak
Signal - A weak reference to a signal’s slots. Useful for allowing slots to maintain a persistant reference to their owning signal without causing a memory leak.
Enums§
- Group
- Represents a group to connect a slot to in a signal.
- Position
- Represents a position to connect a slot to in a group of slots.
Traits§
- Connect0
- Connect trait for signals with slots that accept the corresponding number of arguments.
- Connect1
- Connect trait for signals with slots that accept the corresponding number of arguments.
- Connect2
- Connect trait for signals with slots that accept the corresponding number of arguments.
- Connect3
- Connect trait for signals with slots that accept the corresponding number of arguments.
- Connect4
- Connect trait for signals with slots that accept the corresponding number of arguments.
- Connect5
- Connect trait for signals with slots that accept the corresponding number of arguments.
- Connect6
- Connect trait for signals with slots that accept the corresponding number of arguments.
- Connect7
- Connect trait for signals with slots that accept the corresponding number of arguments.
- Connect8
- Connect trait for signals with slots that accept the corresponding number of arguments.
- Connect9
- Connect trait for signals with slots that accept the corresponding number of arguments.
- Connect10
- Connect trait for signals with slots that accept the corresponding number of arguments.
- Connect11
- Connect trait for signals with slots that accept the corresponding number of arguments.
- Connect12
- Connect trait for signals with slots that accept the corresponding number of arguments.
- Emit0
- Emit trait for signals with slots that accept the corresponding number of arguments.
- Emit1
- Emit trait for signals with slots that accept the corresponding number of arguments.
- Emit2
- Emit trait for signals with slots that accept the corresponding number of arguments.
- Emit3
- Emit trait for signals with slots that accept the corresponding number of arguments.
- Emit4
- Emit trait for signals with slots that accept the corresponding number of arguments.
- Emit5
- Emit trait for signals with slots that accept the corresponding number of arguments.
- Emit6
- Emit trait for signals with slots that accept the corresponding number of arguments.
- Emit7
- Emit trait for signals with slots that accept the corresponding number of arguments.
- Emit8
- Emit trait for signals with slots that accept the corresponding number of arguments.
- Emit9
- Emit trait for signals with slots that accept the corresponding number of arguments.
- Emit10
- Emit trait for signals with slots that accept the corresponding number of arguments.
- Emit11
- Emit trait for signals with slots that accept the corresponding number of arguments.
- Emit12
- Emit trait for signals with slots that accept the corresponding number of arguments.
Type Aliases§
- Connection
- A connection manages one slot for one particular signal. Connections carry no type information about their underlying signal. Connections are created when new slots are connected to a signal.
- Scoped
Connection - Scoped connections are identical to regular connections, except that they will automcatically disconnect themselves when dropped.