DemesneGH commented on code in PR #296:
URL: 
https://github.com/apache/teaclave-trustzone-sdk/pull/296#discussion_r3159712214


##########
examples/supp_plugin-rs/plugin/build.rs:
##########
@@ -15,32 +15,14 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use anyhow::{anyhow, Result};
-use std::env;
-use std::fs::File;
-use std::io::Write;
-use std::path::PathBuf;
-use uuid::Uuid;
-
-fn main() -> Result<()> {
-    let out = &PathBuf::from(env::var_os("OUT_DIR").ok_or_else(|| 
anyhow!("OUT_DIR not set"))?);
-    let mut buffer = File::create(out.join("plugin_static.rs"))?;
-    buffer.write_all(include_bytes!("plugin_static.rs"))?;
-
-    let plugin_uuid = Uuid::parse_str(proto::PLUGIN_UUID)?;
-    let (time_low, time_mid, time_hi_and_version, clock_seq_and_node) = 
plugin_uuid.as_fields();
-
-    writeln!(buffer)?;
-    write!(
-        buffer,
-        "const PLUGIN_UUID_STRUCT: optee_teec::raw::TEEC_UUID = 
optee_teec::raw::TEEC_UUID {{
-    timeLow: {:#x},
-    timeMid: {:#x},
-    timeHiAndVersion: {:#x},
-    clockSeqAndNode: {:#x?},
-}};",
-        time_low, time_mid, time_hi_and_version, clock_seq_and_node
-    )?;
+fn main() -> anyhow::Result<()> {
+    let config = optee_teec_plugin_bindgen::Config::new(
+        "syslog",
+        uuid::Uuid::parse_str(proto::PLUGIN_UUID)?,
+        "init",
+        "invoke",

Review Comment:
   I see why we're avoiding macros, but using strings for function names is a 
bit weird. 
   Since most users don't need custom names anyway, how about  using defaults 
like `plugin_init` and `plugin_invoke`? Then the default constructor only 
requires the name and UUID. This would clean up the API and eliminate potential 
typos in `build.rs`.
   
   We can also provide one more constructor that accepts the customized fn name 
if you'd like to. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to