ngx/core/
mod.rs

1mod buffer;
2mod pool;
3mod status;
4mod string;
5
6pub use buffer::*;
7pub use pool::*;
8pub use status::*;
9pub use string::*;
10
11/// Gets an outer object pointer from a pointer to one of its fields.
12/// While there is no corresponding C macro, the pattern is common in the NGINX source.
13///
14/// # Safety
15///
16/// `$ptr` must be a valid pointer to the field `$field` of `$type`.
17#[macro_export]
18macro_rules! ngx_container_of {
19    ($ptr:expr, $type:path, $field:ident) => {
20        $ptr.byte_sub(::core::mem::offset_of!($type, $field)).cast::<$type>()
21    };
22}