1pub use extism_pdk::{config, error, info, log, warn};
18use extism_pdk::{plugin_fn, FnResult, Prost};
19
20pub use extensions_proto;
22pub use preferences_proto;
23pub use songs_proto;
24pub use themes_proto;
25pub use ui_proto;
26pub use duration_proto;
27pub use prost_types;
28pub use extensions_proto::moosync::types::*;
29pub use preferences_proto::moosync::types::*;
30pub use songs_proto::moosync::types::*;
31pub use themes_proto::moosync::types::*;
32pub use ui_proto::moosync::types::*;
33
34pub mod api;
35pub mod handler;
36pub mod http;
37pub mod response_utils;
38
39pub use api::MoosyncResult;
40pub use handler::MoosyncError;
41
42unsafe extern "C" {
43 fn init();
44}
45
46#[tracing::instrument(level = "debug", skip())]
47#[plugin_fn]
48pub fn entry() -> FnResult<()> {
49 unsafe {
50 init();
51 }
52 Ok(())
53}
54
55#[tracing::instrument(level = "debug", skip())]
56#[plugin_fn]
57pub fn handle_extension_command(
58 Prost(cmd): Prost<ExtensionCommand>,
59) -> FnResult<Prost<ExtensionCommandResponse>> {
60 let res = handler::handle_command(cmd)?;
61 Ok(Prost(res))
62}
63
64pub fn duration_to_proto(d: std::time::Duration) -> duration_proto::google::protobuf::Duration {
66 duration_proto::google::protobuf::Duration {
67 seconds: d.as_secs() as i64,
68 nanos: d.subsec_nanos() as i32,
69 }
70}