Skip to content

Commit

Permalink
fix(computegraph): use absolute path for computegraph in the node macro
Browse files Browse the repository at this point in the history
  • Loading branch information
maximmaxim345 committed Jun 11, 2024
1 parent d7bd7ef commit 9d8c20d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions crates/computegraph_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,10 @@ fn node_impl(args: TokenStream, input: TokenStream) -> TokenStream {
};
let input_name = ident.to_string();
quote! {
pub fn #fn_ident(&self) -> computegraph::InputPort<#base_type> {
computegraph::InputPort {
pub fn #fn_ident(&self) -> ::computegraph::InputPort<#base_type> {
::computegraph::InputPort {
port_type: ::std::marker::PhantomData,
port: computegraph::InputPortUntyped {
port: ::computegraph::InputPortUntyped {
node: self.handle.clone(),
input_name: #input_name,
},
Expand All @@ -373,10 +373,10 @@ fn node_impl(args: TokenStream, input: TokenStream) -> TokenStream {
};
let output_name = ident.to_string();
quote! {
pub fn #fn_ident(&self) -> computegraph::OutputPort<#base_type> {
computegraph::OutputPort {
pub fn #fn_ident(&self) -> ::computegraph::OutputPort<#base_type> {
::computegraph::OutputPort {
port_type: ::std::marker::PhantomData,
port: computegraph::OutputPortUntyped {
port: ::computegraph::OutputPortUntyped {
node: self.handle.clone(),
output_name: #output_name,
},
Expand All @@ -397,15 +397,15 @@ fn node_impl(args: TokenStream, input: TokenStream) -> TokenStream {

quote! {
pub struct #handle_name {
pub handle: computegraph::NodeHandle
pub handle: ::computegraph::NodeHandle
}

impl #handle_name {
#(#handle_input_ports)*
#(#handle_output_ports)*
}

impl computegraph::NodeFactory for #node_name {
impl ::computegraph::NodeFactory for #node_name {
type Handle = #handle_name;

fn inputs() -> ::std::vec::Vec<(&'static str, ::core::any::TypeId)> {
Expand All @@ -420,14 +420,14 @@ fn node_impl(args: TokenStream, input: TokenStream) -> TokenStream {
]
}

fn create_handle(gnode: &computegraph::GraphNode) -> Self::Handle {
fn create_handle(gnode: &::computegraph::GraphNode) -> Self::Handle {
Self::Handle {
handle: gnode.handle.clone(),
}
}
}

impl computegraph::ExecutableNode for #node_name {
impl ::computegraph::ExecutableNode for #node_name {
fn run(&self, input: &[::std::boxed::Box<dyn ::std::any::Any>]) -> Vec<::std::boxed::Box<dyn ::std::any::Any>> {
let res = self.run(
#( input[#run_call_parameters].downcast_ref().unwrap() ),*
Expand Down

0 comments on commit 9d8c20d

Please sign in to comment.