vrl/stdlib/
wasm_unsupported_function.rs

1use crate::compiler::prelude::*;
2
3#[derive(Debug, Clone)]
4pub struct WasmUnsupportedFunction {
5    span: Span,
6    type_def: TypeDef,
7}
8
9impl WasmUnsupportedFunction {
10    #[must_use]
11    pub fn new(span: Span, type_def: TypeDef) -> Self {
12        Self { span, type_def }
13    }
14}
15
16impl FunctionExpression for WasmUnsupportedFunction {
17    fn resolve(&self, _: &mut Context) -> Resolved {
18        Err(ExpressionError::Abort {
19            span: self.span,
20            message: Some("This function is not supported in WebAssembly".to_owned()),
21        })
22    }
23
24    fn type_def(&self, _: &state::TypeState) -> TypeDef {
25        self.type_def.clone()
26    }
27}