extism-0.3.0: Extism bindings
Safe HaskellSafe-Inferred
LanguageHaskell2010

Extism

Synopsis

Documentation

type Result a = Either Error a Source #

Result type

newtype Error Source #

Extism error

Constructors

ExtismError String 

Instances

Instances details
Show Error Source # 
Instance details

Defined in Extism

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

newtype Context Source #

Context for managing plugins

Constructors

Context (ForeignPtr ExtismContext) 

data Plugin Source #

Plugins can be used to call WASM function

Constructors

Plugin Context Int32 

data CancelHandle Source #

Constructors

CancelHandle (Ptr ExtismCancelHandle) 

data LogLevel Source #

Log level

Constructors

Error 
Warn 
Info 
Debug 
Trace 

Instances

Instances details
Show LogLevel Source # 
Instance details

Defined in Extism

free :: Plugin -> IO () Source #

Free a Plugin, this will automatically be called for every plugin | associated with a Context when that Context is freed

reset :: Context -> IO () Source #

Remove all registered plugins in a Context

fromByteString :: ByteString -> String Source #

Helper function to convert a ByteString to a String

update :: Plugin -> ByteString -> Bool -> IO (Result ()) Source #

Update a Plugin with a new WASM module

isValid :: Plugin -> Bool Source #

Check if a Plugin is valid

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

plugin :: Context -> ByteString -> Bool -> IO (Result Plugin) Source #

Create a Plugin from a WASM module, useWasi determines if WASI should | be linked

createPlugin :: ByteString -> Bool -> IO (Result Plugin) Source #

Create a Plugin with its own Context

updateManifest :: Plugin -> Manifest -> Bool -> IO (Result ()) Source #

Update a Plugin with a new Manifest

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

data Manifest #

Instances

Instances details
JSON Manifest 
Instance details

Defined in Extism.Manifest

toString :: JSON a => a -> String #