|
24 | 24 | //! ```rust,no_run |
25 | 25 | //! use nginx_sys::nginx_version; |
26 | 26 | //! |
27 | | -//! let version = unsafe { nginx_version() }; |
28 | | -//! println!("Nginx version: {}", version); |
| 27 | +//! println!("Nginx version: {}", nginx_version); |
29 | 28 | //! ``` |
30 | 29 | //! |
31 | 30 | #![warn(missing_docs)] |
@@ -77,7 +76,7 @@ pub unsafe fn bytes_to_uchar(pool: *mut ngx_pool_t, data: &[u8]) -> Option<*mut |
77 | 76 | /// A raw pointer (`*mut u_char`) to the allocated memory containing the converted string data. |
78 | 77 | /// |
79 | 78 | /// # Example |
80 | | -/// ```rust |
| 79 | +/// ```rust,ignore |
81 | 80 | /// let pool: *mut ngx_pool_t = ...; // Obtain a pointer to the nginx memory pool |
82 | 81 | /// let data: &str = "example"; // The string to convert |
83 | 82 | /// let ptr = str_to_uchar(pool, data); |
@@ -237,11 +236,15 @@ impl TryFrom<ngx_str_t> for &str { |
237 | 236 | /// |
238 | 237 | /// # Example |
239 | 238 | /// ```rust |
240 | | -/// let table: *mut ngx_table_elt_t = ...; // Obtain a pointer to the nginx table entry |
241 | | -/// let pool: *mut ngx_pool_t = ...; // Obtain a pointer to the nginx memory pool |
| 239 | +/// # use nginx_sys::*; |
| 240 | +/// # unsafe fn example(pool: *mut ngx_pool_t, headers: *mut ngx_list_t) { |
| 241 | +/// // Obtain a pointer to the nginx table entry |
| 242 | +/// let table: *mut ngx_table_elt_t = ngx_list_push(headers).cast(); |
| 243 | +/// assert!(!table.is_null()); |
242 | 244 | /// let key: &str = "key"; // The key to add |
243 | 245 | /// let value: &str = "value"; // The value to add |
244 | 246 | /// let result = add_to_ngx_table(table, pool, key, value); |
| 247 | +/// # } |
245 | 248 | /// ``` |
246 | 249 | pub unsafe fn add_to_ngx_table( |
247 | 250 | table: *mut ngx_table_elt_t, |
|
0 commit comments