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