use std::{
error::Error,
fmt::{Debug, Display, Formatter},
};
use pyo3::prelude::*;
use tauri_plugin_os::{self as plugin};
use crate::{ext_mod::plugin::Plugin, tauri_runtime::Runtime};
#[derive(Debug)]
struct PluginError(plugin::Error);
impl Display for PluginError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
Display::fmt(&self.0, f)
}
}
impl Error for PluginError {}
impl From<PluginError> for PyErr {
fn from(value: PluginError) -> Self {
match value.0 {}
}
}
impl From<plugin::Error> for PluginError {
fn from(value: plugin::Error) -> Self {
Self(value)
}
}
#[pyfunction]
pub fn init() -> Plugin {
Plugin::new(Box::new(|| Box::new(plugin::init::<Runtime>())))
}
#[pymodule(submodule, gil_used = false)]
pub mod os {
#[pymodule_export]
pub use super::init;
}