pub struct HostFunctionContext {
pub plugin_name: String,
pub request_id: String,
pub memory: Arc<RwLock<Vec<u8>>>,
pub config: HashMap<String, Value>,
pub start_time: Instant,
}Expand description
Host function context (passed to function implementations)
Fields§
§plugin_name: StringPlugin name
request_id: StringRequest ID
memory: Arc<RwLock<Vec<u8>>>Plugin memory (for reading/writing)
config: HashMap<String, Value>Plugin configuration
start_time: InstantCall start time
Implementations§
Source§impl HostFunctionContext
impl HostFunctionContext
Sourcepub fn read_string(
&self,
ptr: i32,
len: i32,
) -> Result<String, HostFunctionError>
pub fn read_string( &self, ptr: i32, len: i32, ) -> Result<String, HostFunctionError>
Read a string from plugin memory
Sourcepub fn read_bytes(
&self,
ptr: i32,
len: i32,
) -> Result<Vec<u8>, HostFunctionError>
pub fn read_bytes( &self, ptr: i32, len: i32, ) -> Result<Vec<u8>, HostFunctionError>
Read bytes from plugin memory
Sourcepub fn write_bytes(
&self,
ptr: i32,
data: &[u8],
) -> Result<(), HostFunctionError>
pub fn write_bytes( &self, ptr: i32, data: &[u8], ) -> Result<(), HostFunctionError>
Write bytes to plugin memory
Auto Trait Implementations§
impl Freeze for HostFunctionContext
impl !RefUnwindSafe for HostFunctionContext
impl Send for HostFunctionContext
impl Sync for HostFunctionContext
impl Unpin for HostFunctionContext
impl UnsafeUnpin for HostFunctionContext
impl !UnwindSafe for HostFunctionContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more