extism-pdk-0.1.0.0: Extism Plugin Development Kit
Safe HaskellSafe-Inferred
LanguageHaskell2010

Extism.PDK

Synopsis

Documentation

data Memory Source #

Represents a block of memory

newtype JSONValue a Source #

Constructors

JSONValue a 

Instances

Instances details
JSON a => FromBytes (JSONValue a) Source # 
Instance details

Defined in Extism.PDK

JSON a => ToBytes (JSONValue a) Source # 
Instance details

Defined in Extism.PDK

newtype MsgPackValue a Source #

Constructors

MsgPackValue a 

Instances

Instances details
MsgPack a => FromBytes (MsgPackValue a) Source # 
Instance details

Defined in Extism.PDK

MsgPack a => ToBytes (MsgPackValue a) Source # 
Instance details

Defined in Extism.PDK

class FromBytes a where Source #

Methods

fromBytes :: ByteString -> a Source #

Instances

Instances details
FromBytes ByteString Source # 
Instance details

Defined in Extism.PDK

FromBytes String Source # 
Instance details

Defined in Extism.PDK

JSON a => FromBytes (JSONValue a) Source # 
Instance details

Defined in Extism.PDK

MsgPack a => FromBytes (MsgPackValue a) Source # 
Instance details

Defined in Extism.PDK

class ToBytes a where Source #

Methods

toBytes :: a -> ByteString Source #

Instances

Instances details
ToBytes ByteString Source # 
Instance details

Defined in Extism.PDK

ToBytes String Source # 
Instance details

Defined in Extism.PDK

JSON a => ToBytes (JSONValue a) Source # 
Instance details

Defined in Extism.PDK

MsgPack a => ToBytes (MsgPackValue a) Source # 
Instance details

Defined in Extism.PDK

data LogLevel Source #

Constructors

Info 
Debug 
Warn 
Error 

free :: Memory -> IO () Source #

Free a Memory block

fromByteString :: ByteString -> String Source #

Helper function to convert a bytestring to a string

toByteString :: String -> ByteString Source #

Helper function to convert a string to a bytestring

input :: FromBytes a => IO a Source #

Get plugin input as ByteString

inputMemory :: IO Memory Source #

Get plugin input as Memory block

inputJSON :: JSON a => IO (Maybe a) Source #

Get input as JSON

load :: FromBytes a => Memory -> IO a Source #

Load data from Memory block

store :: ToBytes a => Memory -> a -> IO () Source #

Store data into a Memory block

outputMemory :: Memory -> IO () Source #

Set plugin output to the provided Memory block

output :: ToBytes a => a -> IO () Source #

Set plugin output to the provided ByteString

outputJSON :: JSON a => a -> IO () Source #

Set plugin output to a JSON encoded version of the provided value

loadString :: Memory -> IO String Source #

Load string from Memory block

storeString :: Memory -> String -> IO () Source #

Store string in Memory block

alloc :: Int -> IO Memory Source #

Allocate a new Memory block

allocByteString :: ByteString -> IO Memory Source #

Allocate a new Memory block and copy the contents of the provided ByteString

allocString :: String -> IO Memory Source #

Allocate a new Memory block and copy the contents of the provided String

memoryOffset :: Memory -> MemoryOffset Source #

Get the offset of a Memory block

memoryLength :: Memory -> MemoryLength Source #

Get the length of a Memory block

findMemory :: MemoryOffset -> IO Memory Source #

Find Memory block by offset

getVar :: String -> IO (Maybe ByteString) Source #

Get a variable from the Extism runtime

setVar :: ToBytes a => String -> Maybe a -> IO () Source #

Set a variable

getConfig :: String -> IO (Maybe String) Source #

Get a configuration value

setError :: String -> IO () Source #

Set the current error message

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