Skip to content

Commit

Permalink
feat(rust-sdk): new API NNPreload::new
Browse files Browse the repository at this point in the history
Signed-off-by: Xin Liu <sam@secondstate.io>
  • Loading branch information
apepkuss committed Sep 25, 2023
1 parent 7e99c65 commit 844f623
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<str>,
backend: NNBackend,
target: ExecutionTarget,
path: impl AsRef<std::path::Path>,
) -> 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!(
Expand Down

0 comments on commit 844f623

Please sign in to comment.