use ;
use Rc;
/// A callback property for sub-[`Component`][Component]s.
///
/// When a subcomponent needs to communicate with its parent, you can use a `Callback`
/// to simulate a signal handler.
///
/// This is how you would declare a callback property that receives a [`String`][String] when
/// something happens inside the subcomponent. The property value should be a closure
/// which receives the [`String`][String] and returns a message for the parent component, of the
/// parent component's [`Component::Message`][Message] type. The framework will automatically take
/// care of figuring out the callback's type signature when you mount the subcomponent.
///
/// Note that the [`Default`][Default] implementation for `Callback` constructs an empty callback,
/// which does nothing and allocates nothing. This is the desired behaviour when using a callback
/// as a [`Component`][Component] property: if the user doesn't specify a callback explicitly, there
/// shouldn't be a callback.
///
/// ```rust,no_run
/// # use vgtk::Callback;
/// struct MyComponentProperties {
/// on_message: Callback<String>,
/// }
/// ```
///
/// This is how you might provide a callback property to the above:
///
/// ```rust,no_run
/// # use vgtk::{gtk, VNode, Component, Callback};
/// # #[derive(Clone, Debug, Default)]
/// # pub struct MyComponent {
/// # pub on_message: Callback<String>,
/// # }
/// # impl Component for MyComponent {
/// # type Message = ();
/// # type Properties = Self;
/// # fn view(&self) -> VNode<Self> { todo!() }
/// # }
/// # #[derive(Clone, Debug)] enum ParentMessage { StringReceived(String) }
/// # #[derive(Default)] struct Parent;
/// # impl Component for Parent { type Message = ParentMessage; type Properties = ();
/// # fn view(&self) -> VNode<Self> { gtk! {
/// <@MyComponent on_message=|string| ParentMessage::StringReceived(string) />
/// # }}}
/// ```
///
/// [Component]: trait.Component.html
/// [Message]: trait.Component.html#associatedtype.Message
/// [Default]: https://doc.rust-lang.org/std/default/trait.Default.html
/// [String]: https://doc.rust-lang.org/std/string/struct.String.html
/// [Option]: https://doc.rust-lang.org/std/option/enum.Option.html
);