This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Debug, Default, Validate, Deserialize,Clone)] | |
struct SignupData { | |
#[validate(email)] | |
mail: String, | |
#[validate(phone)] | |
phone: String, | |
#[validate(url)] | |
site: String, | |
#[validate(length(min = 1), custom = "validate_unique_username")] | |
#[serde(rename = "firstName")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Debug, Validate, Deserialize)] | |
struct SignupData { | |
#[validate(email)] | |
mail: String, | |
#[validate(phone)] | |
phone: String, | |
#[validate(url)] | |
site: String, | |
#[validate(length(min = 1), custom = "validate_unique_username")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An example To-do seed application, includes filtering of todos | |
// Each UI component is naturally scoped to specific state changes. | |
// This makes each part understandable | |
// The UI elements are themselves `#[computed]` properties of the | |
// underyling state and only update if the underlying state changes. | |
#[derive(Clone)] | |
struct Todo{ | |
idx: usize, | |
description: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An example To-do seed application, includes filtering of todos | |
// Each UI component is naturally scoped to specific state changes. | |
// This makes each part understandable | |
// The UI elements are themselves `#[computed]` properties of the | |
// underyling state and only update if the underlying state changes. | |
#[derive(Clone)] | |
struct Todo{ | |
idx: usize, | |
description: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Clone)] | |
struct Todo{ | |
idx: usize, | |
description: String, | |
complete: bool, | |
} | |
// Atom of state, a vector holding Todo structs | |
#[state] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[view_macro] | |
fn showcard_view<Ms: 'static>( | |
opts: ShowOpts, | |
root: Node<Ms>, | |
_children: Vec<Node<Ms>>, | |
mut title: Node<Ms>, | |
mut description: Node<Ms>, | |
award: Vec<(Node<Ms>, AwardOpts)>, | |
) -> Node<Ms> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct RegisterId{ | |
id: i32 | |
} | |
struct FsValue { | |
value: String, | |
} | |
struct FsPointer{ | |
value_at_mem_location:usize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(proc_macro_hygiene)] | |
use my_macros::{view_macro,process_part}; | |
#[macro_export] | |
macro_rules! some_rando_global_name_hohoho_left { | |
() => { | |
println!("yes this prints 1"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate proc_macro; | |
use self::proc_macro::TokenStream; | |
use quote::{format_ident, quote}; | |
use syn::parse::{Parse, ParseStream, Result}; | |
use syn::{parse_macro_input, Expr}; | |
use syn::{ItemFn}; | |
#[proc_macro_attribute] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn basic_styled_counter() -> Node<Msg> { | |
div![ | |
h3!["Basic Styled Counter"], | |
md![ | |
r#"This is a basic styled button, the button is styled with the following | |
``` | |
S.padding_left(px(24)) | |
.padding_right(px(24)) | |
.padding_top(px(8)) |