extism 0.1.0 → 0.2.0
raw patch · 3 files changed
+18/−3 lines, 3 filesdep ~basedep ~extism-manifestPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, extism-manifest
API changes (from Hackage documentation)
+ Extism: CancelHandle :: Ptr ExtismCancelHandle -> CancelHandle
+ Extism: cancel :: CancelHandle -> IO Bool
+ Extism: cancelHandle :: Plugin -> IO CancelHandle
+ Extism: data CancelHandle
Files
- extism.cabal +3/−3
- src/Extism.hs +12/−0
- src/Extism/Bindings.hs +3/−0
extism.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: extism-version: 0.1.0+version: 0.2.0 license: BSD-3-Clause maintainer: oss@extism.org author: Extism authors@@ -19,10 +19,10 @@ extra-libraries: extism extra-lib-dirs: /usr/local/lib build-depends:- base >= 4.16.1 && < 4.18.0,+ base >= 4.16.1 && < 4.19.0, bytestring >= 0.11.3 && < 0.12, json >= 0.10 && < 0.11,- extism-manifest >= 0.0.0 && < 0.2.0+ extism-manifest >= 0.0.0 && < 0.3.0 test-suite extism-example type: exitcode-stdio-1.0
src/Extism.hs view
@@ -19,6 +19,8 @@ -- | Plugins can be used to call WASM function data Plugin = Plugin Context Int32 +data CancelHandle = CancelHandle (Ptr ExtismCancelHandle)+ -- | Log level data LogLevel = Error | Warn | Info | Debug | Trace deriving (Show) @@ -172,3 +174,13 @@ free :: Plugin -> IO () free (Plugin (Context ctx) plugin) = withForeignPtr ctx (`extism_plugin_free` plugin)++cancelHandle :: Plugin -> IO CancelHandle+cancelHandle (Plugin (Context ctx) plugin) = do+ handle <- withForeignPtr ctx (\ctx -> extism_plugin_cancel_handle ctx plugin)+ return (CancelHandle handle)++cancel :: CancelHandle -> IO Bool+cancel (CancelHandle handle) = + extism_plugin_cancel handle+
src/Extism/Bindings.hs view
@@ -10,6 +10,7 @@ newtype ExtismContext = ExtismContext () deriving Show newtype ExtismFunction = ExtismFunction () deriving Show+newtype ExtismCancelHandle = ExtismCancelHandle () deriving Show foreign import ccall safe "extism.h extism_context_new" extism_context_new :: IO (Ptr ExtismContext) foreign import ccall safe "extism.h &extism_context_free" extism_context_free :: FunPtr (Ptr ExtismContext -> IO ())@@ -25,3 +26,5 @@ foreign import ccall safe "extism.h extism_plugin_free" extism_plugin_free :: Ptr ExtismContext -> Int32 -> IO () foreign import ccall safe "extism.h extism_context_reset" extism_context_reset :: Ptr ExtismContext -> IO () foreign import ccall safe "extism.h extism_version" extism_version :: IO CString+foreign import ccall safe "extism.h extism_plugin_cancel_handle" extism_plugin_cancel_handle :: Ptr ExtismContext -> Int32 -> IO (Ptr ExtismCancelHandle)+foreign import ccall safe "extism.h extism_plugin_cancel" extism_plugin_cancel :: Ptr ExtismCancelHandle -> IO Bool