Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type Result a = Either Error a
- newtype Error = ExtismError String
- type CurrentPlugin = Ptr ExtismCurrentPlugin
- newtype Context = Context (ForeignPtr ExtismContext)
- data Function = Function (ForeignPtr ExtismFunction) (StablePtr ())
- data Plugin = Plugin Context Int32 [Function]
- newtype CancelHandle = CancelHandle (Ptr ExtismCancelHandle)
- data LogLevel
- free :: Plugin -> IO ()
- reset :: Context -> IO ()
- fromByteString :: ByteString -> String
- update :: Plugin -> ByteString -> [Function] -> Bool -> IO (Result Plugin)
- isValid :: Plugin -> Bool
- plugin :: Context -> ByteString -> [Function] -> Bool -> IO (Result Plugin)
- toByteString :: String -> ByteString
- extismVersion :: () -> IO String
- newContext :: IO Context
- withContext :: (Context -> IO a) -> IO a
- withPlugin :: (Plugin -> IO a) -> Plugin -> IO a
- createPlugin :: ByteString -> [Function] -> Bool -> IO (Result Plugin)
- pluginFromManifest :: Context -> Manifest -> [Function] -> Bool -> IO (Result Plugin)
- createPluginFromManifest :: Manifest -> [Function] -> Bool -> IO (Result Plugin)
- updateManifest :: Plugin -> Manifest -> [Function] -> Bool -> IO (Result Plugin)
- setConfig :: Plugin -> [(String, Maybe String)] -> IO Bool
- levelStr :: LogLevel -> String
- setLogFile :: String -> LogLevel -> IO Bool
- functionExists :: Plugin -> String -> IO Bool
- call :: Plugin -> String -> ByteString -> IO (Result ByteString)
- cancelHandle :: Plugin -> IO CancelHandle
- cancel :: CancelHandle -> IO Bool
- hostFunction :: String -> [ValType] -> [ValType] -> (CurrentPlugin -> [Val] -> a -> IO [Val]) -> a -> IO Function
- toI32 :: Integral a => a -> Val
- toI64 :: Integral a => a -> Val
- toF32 :: Float -> Val
- toF64 :: Double -> Val
- fromI32 :: Integral a => Val -> Maybe a
- fromI64 :: Integral a => Val -> Maybe a
- fromF32 :: Val -> Maybe Float
- fromF64 :: Val -> Maybe Double
- data Manifest
- toString :: JSON a => a -> String
- data ValType
- data Val
Documentation
Extism error
type CurrentPlugin = Ptr ExtismCurrentPlugin Source #
Access the plugin that is currently executing from inside a host function
Log level
fromByteString :: ByteString -> String Source #
Helper function to convert a ByteString
to a String
update :: Plugin -> ByteString -> [Function] -> Bool -> IO (Result Plugin) Source #
Update a Plugin
with a new WASM module
plugin :: Context -> ByteString -> [Function] -> Bool -> IO (Result Plugin) Source #
Create a Plugin
from a WASM module, useWasi
determines if WASI should
| be linked
toByteString :: String -> ByteString Source #
Helper function to convert a String
to a ByteString
extismVersion :: () -> IO String Source #
Get the Extism version string
withContext :: (Context -> IO a) -> IO a Source #
Execute a function with a new Context
that is destroyed when it returns
createPlugin :: ByteString -> [Function] -> Bool -> IO (Result Plugin) Source #
setConfig :: Plugin -> [(String, Maybe String)] -> IO Bool Source #
Set configuration values for a plugin
setLogFile :: String -> LogLevel -> IO Bool Source #
Set the log file and level, this is a global configuration
functionExists :: Plugin -> String -> IO Bool Source #
Check if a function exists in the given plugin
call :: Plugin -> String -> ByteString -> IO (Result ByteString) Source #
cancelHandle :: Plugin -> IO CancelHandle Source #
Create a new CancelHandle
that can be used to cancel a running plugin
| from another thread.
cancel :: CancelHandle -> IO Bool Source #
Cancel a running plugin using a CancelHandle
hostFunction :: String -> [ValType] -> [ValType] -> (CurrentPlugin -> [Val] -> a -> IO [Val]) -> a -> IO Function Source #
Instances
Storable ValType Source # | |
Show ValType Source # | |
Eq ValType Source # | |