{ "Relm4 Component": { "prefix": "relm-component", "description": "Relm4 Component Widget", "body": [ "use relm4::{gtk, Component, ComponentSender, ComponentParts};", "", "pub struct ComponentModel {}", "", "#[derive(Debug)]", "pub enum ComponentInput {}", "", "#[derive(Debug)]", "pub enum ComponentOutput {}", "", "pub struct ComponentInit {}", "", "#[relm4::component(pub)]", "impl Component for ComponentModel {", " type CommandOutput = ();", " type Input = ComponentInput;", " type Output = ComponentOutput;", " type Init = ComponentInit;", "", " view! {", " #[root]", " gtk::Box {", "", " }", " }", "", " fn init(", " init: Self::Init,", " root: &Self::Root,", " sender: ComponentSender,", " ) -> ComponentParts {", " let model = ComponentModel {};", " let widgets = view_output!();", " ComponentParts { model, widgets }", " }", "", " fn update(&mut self, message: Self::Input, sender: ComponentSender, root: &Self::Root) {", " match message {", "", " }", " }", "}" ] }, "Relm4 Simple Component": { "prefix": "relm-simple-component", "description": "Relm4 SimpleComponent Widget", "body": [ "use relm4::{gtk, SimpleComponent, ComponentSender, ComponentParts};", "", "pub struct ComponentModel {}", "", "#[derive(Debug)]", "pub enum ComponentInput {}", "", "#[derive(Debug)]", "pub enum ComponentOutput {}", "", "pub struct ComponentInit {}", "", "#[relm4::component(pub)]", "impl SimpleComponent for ComponentModel {", " type Input = ComponentInput;", " type Output = ComponentOutput;", " type Init = ComponentInit;", "", " view! {", " #[root]", " gtk::Box {", "", " }", " }", "", " fn init(", " init: Self::Init,", " root: &Self::Root,", " sender: ComponentSender,", " ) -> ComponentParts {", " let model = ComponentModel {};", " let widgets = view_output!();", " ComponentParts { model, widgets }", " }", "", " fn update(&mut self, message: Self::Input, sender: ComponentSender) {", " match message {", "", " }", " }", "}" ] }, "Relm4 Async Component": { "prefix": "relm-async-component", "description": "Relm4 Component Widget", "body": [ "use relm4::{gtk, component::{AsyncComponent, AsyncComponentParts}, AsyncComponentSender};", "", "pub struct AsyncComponentModel {}", "", "#[derive(Debug)]", "pub enum AsyncComponentInput {}", "", "#[derive(Debug)]", "pub enum AsyncComponentOutput {}", "", "pub struct AsyncComponentInit {}", "", "#[relm4::component(pub async)]", "impl AsyncComponent for AsyncComponentModel {", " type CommandOutput = ();", " type Input = AsyncComponentInput;", " type Output = AsyncComponentOutput;", " type Init = AsyncComponentInit;", "", " view! {", " #[root]", " gtk::Box {", "", " }", " }", "", " async fn init(", " init: Self::Init,", " root: Self::Root,", " sender: AsyncComponentSender,", " ) -> AsyncComponentParts {", " let model = AsyncComponentModel {};", " let widgets = view_output!();", " AsyncComponentParts { model, widgets }", " }", "", " async fn update(&mut self, message: Self::Input, sender: AsyncComponentSender, _root: &Self::Root) {", " match message {", "", " }", " }", "}" ] }, "Relm4 Async Simple Component": { "prefix": "relm-simple-async-component", "description": "Relm4 SimpleAsyncComponent Widget", "body": [ "use relm4::{gtk, component::{SimpleAsyncComponent, AsyncComponentParts}, AsyncComponentSender};", "", "pub struct AsyncComponentModel {}", "", "#[derive(Debug)]", "pub enum AsyncComponentInput {}", "", "#[derive(Debug)]", "pub enum AsyncComponentOutput {}", "", "pub struct AsyncComponentInit {}", "", "#[relm4::component(pub async)]", "impl SimpleAsyncComponent for AsyncComponentModel {", " type Input = AsyncComponentInput;", " type Output = AsyncComponentOutput;", " type Init = AsyncComponentInit;", "", " view! {", " #[root]", " gtk::Box {", "", " }", " }", "", " async fn init(", " init: Self::Init,", " root: Self::Root,", " sender: AsyncComponentSender,", " ) -> AsyncComponentParts {", " let model = AsyncComponentModel {};", " let widgets = view_output!();", " AsyncComponentParts { model, widgets }", " }", "", " async fn update(&mut self, message: Self::Input, sender: AsyncComponentSender) {", " match message {", "", " }", " }", "}" ] } }