pub struct NoopHostContext { /* private fields */ }Expand description
A no-op host context for testing WASM execution without real backends.
All I/O methods return Unsupported errors. Logs are captured in-memory for test verification.
Implementations§
Source§impl NoopHostContext
impl NoopHostContext
Sourcepub fn new(event_payload: EventPayload) -> Self
pub fn new(event_payload: EventPayload) -> Self
Create a new no-op host context for testing.
Sourcepub fn captured_logs(&self) -> Vec<LogEntry>
pub fn captured_logs(&self) -> Vec<LogEntry>
Get a copy of all captured logs (for test verification).
§Panics
Panics if the Mutex is poisoned (should never happen in normal operation).
Trait Implementations§
Source§impl HostContext for NoopHostContext
impl HostContext for NoopHostContext
Source§async fn query(&self, _graphql: &str, _variables: Value) -> Result<Value>
async fn query(&self, _graphql: &str, _variables: Value) -> Result<Value>
Execute a GraphQL query. Read more
Source§async fn sql_query(&self, _sql: &str, _params: &[Value]) -> Result<Vec<Value>>
async fn sql_query(&self, _sql: &str, _params: &[Value]) -> Result<Vec<Value>>
Execute a raw SQL query. Read more
Source§async fn http_request(
&self,
_method: &str,
_url: &str,
_headers: &[(String, String)],
_body: Option<&[u8]>,
) -> Result<HttpResponse>
async fn http_request( &self, _method: &str, _url: &str, _headers: &[(String, String)], _body: Option<&[u8]>, ) -> Result<HttpResponse>
Make an HTTP request. Read more
Source§async fn storage_get(&self, _bucket: &str, _key: &str) -> Result<Vec<u8>>
async fn storage_get(&self, _bucket: &str, _key: &str) -> Result<Vec<u8>>
Retrieve an object from storage. Read more
Source§async fn storage_put(
&self,
_bucket: &str,
_key: &str,
_body: &[u8],
_content_type: &str,
) -> Result<()>
async fn storage_put( &self, _bucket: &str, _key: &str, _body: &[u8], _content_type: &str, ) -> Result<()>
Store an object to storage. Read more
Source§fn auth_context(&self) -> Result<Value>
fn auth_context(&self) -> Result<Value>
Get the current authenticated user’s context. Read more
Source§fn env_var(&self, _name: &str) -> Result<Option<String>>
fn env_var(&self, _name: &str) -> Result<Option<String>>
Get an environment variable. Read more
Source§fn event_payload(&self) -> &EventPayload
fn event_payload(&self) -> &EventPayload
Get the current event payload (for reference).
Auto Trait Implementations§
impl Freeze for NoopHostContext
impl RefUnwindSafe for NoopHostContext
impl Send for NoopHostContext
impl Sync for NoopHostContext
impl Unpin for NoopHostContext
impl UnsafeUnpin for NoopHostContext
impl UnwindSafe for NoopHostContext
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