Skip to repository content25 lines · 693 B · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T04:05:27.971Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
derive_into_element.rs
1use proc_macro::TokenStream;
2use quote::quote;
3use syn::{DeriveInput, parse_macro_input};
4
5pub fn derive_into_element(input: TokenStream) -> TokenStream {
6 let ast = parse_macro_input!(input as DeriveInput);
7 let type_name = &ast.ident;
8 let (impl_generics, type_generics, where_clause) = ast.generics.split_for_impl();
9
10 let r#gen = quote! {
11 impl #impl_generics gpui::IntoElement for #type_name #type_generics
12 #where_clause
13 {
14 type Element = gpui::ViewElement<Self>;
15
16 #[track_caller]
17 fn into_element(self) -> Self::Element {
18 gpui::ViewElement::new(self)
19 }
20 }
21 };
22
23 r#gen.into()
24}
25