pub struct MethodCommandNode { /* private fields */ }Expand description
A node that turns a method of its source into a command.
Implementations§
Source§impl MethodCommandNode
impl MethodCommandNode
Sourcepub fn new(
method_name: &str,
execute: Rc<dyn Fn(&dyn AnyValue, Option<&BoxedValue>)>,
can_execute: Option<Rc<dyn Fn(&dyn AnyValue, Option<&BoxedValue>) -> bool>>,
depends_on_properties: &[&str],
inpc: Option<Rc<dyn Fn(&dyn AnyValue) -> Option<&dyn INotifyPropertyChanged>>>,
) -> Rc<Self>
pub fn new( method_name: &str, execute: Rc<dyn Fn(&dyn AnyValue, Option<&BoxedValue>)>, can_execute: Option<Rc<dyn Fn(&dyn AnyValue, Option<&BoxedValue>) -> bool>>, depends_on_properties: &[&str], inpc: Option<Rc<dyn Fn(&dyn AnyValue) -> Option<&dyn INotifyPropertyChanged>>>, ) -> Rc<Self>
Creates the node. inpc gives access to the source’s property change
notifications, which re-query the command’s state when one of
depends_on_properties changes.
Trait Implementations§
Source§impl Drop for MethodCommandNode
impl Drop for MethodCommandNode
Source§impl ExpressionNode for MethodCommandNode
impl ExpressionNode for MethodCommandNode
fn state(&self) -> &NodeState
Source§fn build_string(&self, builder: &mut String)
fn build_string(&self, builder: &mut String)
Appends a string representation of the node to
builder.Source§fn on_source_changed(
&self,
source: Option<&BoxedValue>,
_data_validation_error: Option<&BindingError>,
)
fn on_source_changed( &self, source: Option<&BoxedValue>, _data_validation_error: Option<&BindingError>, )
Subscribes to the new source and updates the current value.
Source§fn unsubscribe(&self, old_source: &BoxedValue)
fn unsubscribe(&self, old_source: &BoxedValue)
Unsubscribes from the previous source.
Source§fn build_string_with_nodes(
&self,
builder: &mut String,
nodes: &[Rc<dyn ExpressionNode>],
)
fn build_string_with_nodes( &self, builder: &mut String, nodes: &[Rc<dyn ExpressionNode>], )
Builds a string representation of the binding path up to this node.
fn as_settable(&self) -> Option<&dyn ISettableNode>
fn as_property_accessor_node(&self) -> Option<&dyn IPropertyAccessorNode>
fn as_source_node(&self) -> Option<&dyn SourceNode>
Source§fn is_data_context_node(&self) -> bool
fn is_data_context_node(&self) -> bool
Whether the node reads a data context.
Auto Trait Implementations§
impl !Freeze for MethodCommandNode
impl !RefUnwindSafe for MethodCommandNode
impl !Send for MethodCommandNode
impl !Sync for MethodCommandNode
impl !UnwindSafe for MethodCommandNode
impl Unpin for MethodCommandNode
impl UnsafeUnpin for MethodCommandNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more