varnish-sys 0.7.0

A Rust framework for creating Varnish Caching Proxy extensions
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::ffi::director;
use crate::vcl::{VclBackend, VclResponse};

/// Return the private pointer as a reference to the [`VclBackend`] object
/// FIXME: should it return a `&mut` instead?
pub fn get_backend<S: VclBackend<T>, T: VclResponse>(v: &director) -> &S {
    unsafe {
        v.priv_
            .cast::<S>()
            .as_ref()
            .expect("backend priv_ pointer is null")
    }
}