File tree Expand file tree Collapse file tree 6 files changed +46
-0
lines changed Expand file tree Collapse file tree 6 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
members = [
4
4
" example_package" ,
5
+ " example_package_macro" ,
5
6
" roslibrust" ,
6
7
" roslibrust_codegen" ,
7
8
" roslibrust_codegen_macro" ,
Original file line number Diff line number Diff line change 1
1
# Example RosLibRust Package
2
+
2
3
The point of this package is provide a good example of how to integrate roslibrust into a package using a build.rs file.
3
4
4
5
This package also serves as a testbed for maintainers of roslibrust to refine build.rs integration.
Original file line number Diff line number Diff line change
1
+ [package ]
2
+ name = " example_package_macro"
3
+ version = " 0.1.0"
4
+ edition = " 2021"
5
+
6
+ [dependencies ]
7
+ # The code generated by roslibrust_codegen has dependendencies
8
+ # We need to depend on the crate at build time so that the generate code has access to these dependencies
9
+ roslibrust_codegen = { path = " ../roslibrust_codegen" }
10
+ # This crate contains the actual macro we will invoke
11
+ roslibrust_codegen_macro = { path = " ../roslibrust_codegen_macro" }
Original file line number Diff line number Diff line change
1
+ # Example RosLibRust Package
2
+
3
+ The point of this package is provide a good example of how to integrate roslibrust into a package using the proc macro.
4
+
5
+ This package also serves as a testbed for maintainers of roslibrust to refine proc macro integration.
Original file line number Diff line number Diff line change
1
+ roslibrust_codegen_macro:: find_and_generate_ros_messages!(
2
+ "assets/ros1_test_msgs" ,
3
+ "assets/ros1_common_interfaces"
4
+ ) ;
5
+
6
+ // Example of 'use' pointing to code created by the include! macro
7
+ mod submodule {
8
+ #[ allow( unused_imports) ]
9
+ use crate :: std_msgs:: Header ;
10
+ }
11
+
12
+ // Our actual "main" here doesn't do much, just shows the generate types
13
+ // are here and real.
14
+ fn main ( ) {
15
+ // Note: within our assets there is a folder named ros1_test_msgs which contains a ros package
16
+ // The ros package in its package.xml refers to the name of that package as test_msgs
17
+ // The module that is generated will use the name in package.xml and not the directory
18
+ let data = test_msgs:: Constants :: TEST_STR ;
19
+ println ! ( "Hello World! {data}" ) ;
20
+ }
You can’t perform that action at this time.
0 commit comments