Bunch of changes, like a lot

This commit is contained in:
Elias Wendland
2026-07-17 18:58:52 +02:00
parent f07f54d4c1
commit 3297f60f00
25 changed files with 566 additions and 285 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "convertis-plugin-api"
version.workspace = true
version = "2.0.0"
edition.workspace = true
authors.workspace = true
license.workspace = true
+3 -10
View File
@@ -21,18 +21,12 @@ use std::{
/// The newest stable wire protocol implemented by this SDK.
pub const API_VERSION: u32 = 2;
pub const ENGINE_VERSION: &str = "0.3.0";
pub const MANIFEST_SYMBOL: &[u8] = b"convertis_plugin_manifest\0";
pub const METADATA_SYMBOL_V2: &[u8] = b"convertis_plugin_metadata_v2\0";
pub const AVAILABILITY_SYMBOL_V2: &[u8] = b"convertis_plugin_availability_v2\0";
pub const CONVERT_SYMBOL_V2: &[u8] = b"convertis_plugin_convert_v2\0";
pub const FREE_SYMBOL_V2: &[u8] = b"convertis_plugin_free_string_v2\0";
// Protocol v1 crossed the Rust ABI boundary. These names are kept forever so
// engines can retain an adapter for plugins built before the stable protocol.
pub const LEGACY_MANIFEST_SYMBOL_V1: &[u8] = b"convertis_plugin_manifest_v1\0";
pub const LEGACY_FACTORY_SYMBOL_V1: &[u8] = b"convertis_plugin_create_v1\0";
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub enum ArtifactKind {
File,
@@ -109,7 +103,6 @@ pub trait Plugin: Send + Sync {
fn convert(&self, request: &ConversionRequest) -> Result<(), String>;
}
pub type PluginFactory = unsafe fn() -> Box<dyn Plugin>;
pub type PluginManifest = unsafe extern "C" fn() -> *const std::ffi::c_char;
pub type PluginJsonCall = unsafe extern "C" fn() -> *mut c_char;
pub type PluginConvertCall = unsafe extern "C" fn(*const c_char) -> *mut c_char;
@@ -176,12 +169,12 @@ macro_rules! export_plugin {
#[unsafe(no_mangle)]
pub extern "C" fn convertis_plugin_manifest() -> *const std::ffi::c_char {
static MANIFEST: &str = concat!(
"{\"manifest_version\":1,\"protocol_versions\":[2],\"engine_requirement\":\">=",
env!("CARGO_PKG_VERSION"),
"\",\"plugin_id\":\"",
"{\"manifest_version\":1,\"protocol_versions\":[2],\"plugin_id\":\"",
$id,
"\",\"plugin_version\":\"",
env!("CARGO_PKG_VERSION"),
"\",\"engine_version\":\"",
env!("CONVERTIS_ENGINE_VERSION"),
"\",\"target\":\"",
env!("CONVERTIS_TARGET"),
"\"}\0"