varnish 0.6.0

A Rust framework for creating Varnish Caching Proxy extensions
Documentation
---
source: varnish-macros/src/tests.rs
---
mod event2 {
    #[allow(non_snake_case, unused_imports, unused_qualifications, unused_variables)]
    #[allow(clippy::needless_question_mark, clippy::new_without_default)]
    #[automatically_derived]
    mod varnish_generated {
        use std::ffi::{c_char, c_int, c_uint, c_void, CStr};
        use std::ptr::null;
        use varnish::ffi::{
            VCL_BACKEND, VCL_BLOB, VCL_BOOL, VCL_DURATION, VCL_INT, VCL_IP, VCL_PROBE,
            VCL_REAL, VCL_STRING, VCL_TIME, VCL_VOID, VMOD_ABI_Version, VclEvent,
            vmod_data, vmod_priv, vrt_ctx, VMOD_PRIV_METHODS_MAGIC, vmod_priv_methods,
        };
        use varnish::vcl::{Ctx, IntoVCL, PerVclState, Workspace};
        use super::*;
        unsafe extern "C" fn vmod_c_on_event(
            __ctx: *mut vrt_ctx,
            __vp: *mut vmod_priv,
            __ev: VclEvent,
        ) -> VCL_INT {
            let mut __ctx = Ctx::from_ptr(__ctx);
            let mut __call_user_func = || -> Result<_, ::varnish::vcl::VclError> {
                super::on_event(&__ctx, __ev)?;
                Ok(VCL_INT(0))
            };
            __call_user_func()
                .unwrap_or_else(|err| {
                    __ctx.fail(err);
                    VCL_INT(1)
                })
        }
        #[repr(C)]
        pub struct VmodExports {
            vmod_c_on_event: Option<
                unsafe extern "C" fn(
                    __ctx: *mut vrt_ctx,
                    __vp: *mut vmod_priv,
                    __ev: VclEvent,
                ) -> VCL_INT,
            >,
        }
        pub static VMOD_EXPORTS: VmodExports = VmodExports {
            vmod_c_on_event: Some(vmod_c_on_event),
        };
        #[allow(non_upper_case_globals)]
        #[no_mangle]
        pub static Vmod_event2_Data: vmod_data = vmod_data {
            vrt_major: 0,
            vrt_minor: 0,
            file_id: c"12c0145150bdb078f1e8f5f2186f8beaf799d5163796db1e68583cf35e74472e"
                .as_ptr(),
            name: c"event2".as_ptr(),
            func_name: c"Vmod_vmod_event2_Func".as_ptr(),
            func_len: ::std::mem::size_of::<VmodExports>() as c_int,
            func: &VMOD_EXPORTS as *const _ as *const c_void,
            abi: VMOD_ABI_Version.as_ptr(),
            json: JSON.as_ptr(),
            proto: null(),
            vcs: c"".as_ptr(),
            version: c"".as_ptr(),
        };
        const JSON: &CStr = c"(moved to @json.snap files)";
    }
    use varnish::vcl::{Ctx, Event};
    pub fn on_event(ctx: &Ctx, event: Event) -> Result<(), &'static str> {
        Ok(())
    }
}