1
0

feat: fix cstr ffi again

This commit is contained in:
2026-05-10 16:55:09 +08:00
parent 1a45b309e7
commit 7d92f9a4a0
2 changed files with 55 additions and 19 deletions

View File

@@ -12,6 +12,9 @@ mod wrapper;
/// Error occurs in this crate.
#[derive(Debug, TeError)]
enum Error {
/// Error when operating Schema.
#[error("{0}")]
Schema(#[from] wfassoc::highlevel::SchemaError),
/// Error when parsing Schema into Program.
#[error("{0}")]
ParseProgram(#[from] wfassoc::highlevel::ParseProgramError),
@@ -19,10 +22,9 @@ enum Error {
#[error("{0}")]
Program(#[from] wfassoc::highlevel::ProgramError),
#[error("error occurs when parsing into C/C++ string")]
CastIntoCStr(#[from] std::ffi::NulError),
#[error("error occurs when parsing from C/C++ string")]
CastFromCStr(#[from] std::ffi::IntoStringError),
/// Error when manipulating with C-style string.
#[error("{0}")]
CStrFfi(#[from] cstr_ffi::Error),
}
/// Result type used in this crate.
@@ -37,12 +39,12 @@ type Result<T> = std::result::Result<T, Error>;
#[unsafe(no_mangle)]
pub extern "C" fn WFStartup() -> bool {
false
true
}
#[unsafe(no_mangle)]
pub extern "C" fn WFShutdown() -> bool {
false
true
}
#[unsafe(no_mangle)]