Skip to content

Commit

Permalink
Added ability to clone components
Browse files Browse the repository at this point in the history
  • Loading branch information
Deploy Bot committed Aug 18, 2021
1 parent 3d25bff commit 71710fc
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions render_macros/src/child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::element::Element;
use quote::{quote, ToTokens};
use syn::parse::{Parse, ParseStream, Result};

#[derive(Clone)]
pub enum Child {
Element(Element),
RawBlock(syn::Block),
Expand Down
2 changes: 1 addition & 1 deletion render_macros/src/children.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::child::Child;
use quote::{quote, ToTokens};
use syn::parse::{Parse, ParseStream, Result};

#[derive(Default)]
#[derive(Default, Clone)]
pub struct Children {
pub nodes: Vec<Child>,
}
Expand Down
1 change: 1 addition & 0 deletions render_macros/src/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::tags::{ClosingTag, OpenTag};
use quote::{quote, ToTokens};
use syn::parse::{Parse, ParseStream, Result};

#[derive(Clone)]
pub struct Element {
name: syn::Path,
attributes: ElementAttributes,
Expand Down
1 change: 1 addition & 0 deletions render_macros/src/element_attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use syn::spanned::Spanned;

pub type AttributeKey = syn::punctuated::Punctuated<proc_macro2::Ident, proc_macro2::Punct>;

#[derive(Clone)]
pub enum ElementAttribute {
Punned(AttributeKey),
WithValue(AttributeKey, syn::Block),
Expand Down
2 changes: 1 addition & 1 deletion render_macros/src/element_attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use syn::spanned::Spanned;

pub type Attributes = HashSet<ElementAttribute>;

#[derive(Default)]
#[derive(Default, Clone)]
pub struct ElementAttributes {
pub attributes: Attributes,
}
Expand Down
2 changes: 1 addition & 1 deletion render_macros/src/function_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn create_function_component(f: syn::ItemFn) -> TokenStream {
};

TokenStream::from(quote! {
#[derive(Debug)]
#[derive(Debug, Clone)]
#vis struct #struct_name#impl_generics #inputs_block

impl#impl_generics ::render::Render for #struct_name #ty_generics #where_clause {
Expand Down

0 comments on commit 71710fc

Please sign in to comment.