diff --git a/src/plugin.rs b/src/plugin.rs index 0fd69ce31..407c22c58 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -28,6 +28,23 @@ pub struct NNPreload { } #[cfg(feature = "wasi_nn")] #[cfg_attr(docsrs, doc(cfg(feature = "wasi_nn")))] +impl NNPreload { + pub fn new( + alias: impl AsRef, + backend: NNBackend, + target: ExecutionTarget, + path: impl AsRef, + ) -> Self { + Self { + alias: alias.as_ref().to_owned(), + backend, + target, + path: path.as_ref().to_owned(), + } + } +} +#[cfg(feature = "wasi_nn")] +#[cfg_attr(docsrs, doc(cfg(feature = "wasi_nn")))] impl std::fmt::Display for NNPreload { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(