pub struct Backend<S: Serve<T>, T: Transfer> { /* private fields */ }Expand description
Fat wrapper around VCL_BACKEND.
It will handle almost all the necessary boilerplate needed to create a vmod. Most importantly, it destroys/unregisters the backend as part of it’s Drop implementation, and
will convert the C methods to something more idiomatic.
Once created, a Backend’s sole purpose is to exist as a C reference for the VCL. As a
result, you don’t want to drop it until after all the transfers are done. The most common way
is just to have the backend be part of a vmod object because the object won’t be dropped until
the VCL is discarded and that can only happen once all the backend fetches are done.
Implementations§
Source§impl<S: Serve<T>, T: Transfer> Backend<S, T>
impl<S: Serve<T>, T: Transfer> Backend<S, T>
Sourcepub fn get_inner(&self) -> &S
pub fn get_inner(&self) -> &S
Access the inner type wrapped by Backend. Note that it isn’t mut as other threads are
likely to have access to it too.
Sourcepub fn vcl_ptr(&self) -> VCL_BACKEND
pub fn vcl_ptr(&self) -> VCL_BACKEND
Return the C pointer wrapped by the Backend. Conventionally used by the .backend()
methods of VCL objects.