Enum rg3d_ui::message::MessageDirection [−][src]
pub enum MessageDirection {
ToWidget,
FromWidget,
}
Expand description
Message direction allows you to distinguish from where message has came from. Often there is a need to find out who created a message to respond properly. Imagine that we have a NumericUpDown input field for a property and we using some data source to feed data into input field. When we change something in the input field by typing, it creates a message with new value. On other hand we often need to put new value in the input field from some code, in this case we again creating a message. But how to understand from which “side” message has came from? Was it filled in by user and we should create a command to change value in the data source, or it was created from syncing code just to pass new value to UI? This problem solved by setting a direction to a message. Also it solves another problem: often we need to respond to a message only if it did some changes. In this case at first we fire a message with ToWidget direction, widget catches it and checks if changes are needed and if so, it “rethrows” message with direction FromWidget. Listeners are “subscribed” to FromWidget messages only and won’t respond to ToWidget messages.
Variants
ToWidget
Used to indicate a request for changes in a widget.
FromWidget
Used to indicate response from widget if anything has actually changed.
Implementations
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for MessageDirection
impl Send for MessageDirection
impl Sync for MessageDirection
impl Unpin for MessageDirection
impl UnwindSafe for MessageDirection
Blanket Implementations
Mutably borrows from an owned value. Read more
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.