extism-0.2.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 #

data LogLevel Source #

Log level

Constructors

Error 
Warn 
Info 
Debug 
Trace 

Instances

Instances details
Show LogLevel Source # 
Instance details

Defined in Extism

data CancelHandle Source #

Constructors

CancelHandle (Ptr ExtismCancelHandle) 

data Plugin Source #

Plugins can be used to call WASM function

Constructors

Plugin Context Int32 

newtype Context Source #

Context for managing plugins

Constructors

Context (ForeignPtr ExtismContext) 

toByteString :: String -> ByteString Source #

Helper function to convert a String to a ByteString

fromByteString :: ByteString -> String Source #

Helper function to convert a ByteString to a String

extismVersion :: () -> IO String Source #

Get the Extism version string

reset :: Context -> IO () Source #

Remove all registered plugins in a Context

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

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

Update a Plugin with a new WASM module

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

Update a Plugin with a new Manifest

isValid :: Plugin -> Bool Source #

Check if a Plugin is valid

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

free :: Plugin -> IO () Source #

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

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

data Manifest #

Instances

Instances details
JSON Manifest 
Instance details

Defined in Extism.Manifest

Methods

readJSON :: JSValue -> Result Manifest

showJSON :: Manifest -> JSValue

readJSONs :: JSValue -> Result [Manifest]

showJSONs :: [Manifest] -> JSValue