We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8241ebc commit 6cc7a0bCopy full SHA for 6cc7a0b
nginx-sys/src/lib.rs
@@ -98,6 +98,23 @@ impl ngx_module_t {
98
}
99
100
101
+impl ngx_variable_value_t {
102
+ /// Returns the contents of this variable value as a byte slice.
103
+ pub fn as_bytes(&self) -> &[u8] {
104
+ match self.len() {
105
+ 0 => &[],
106
+ // SAFETY: data for non-empty value must be a valid well-aligned pointer.
107
+ len => unsafe { core::slice::from_raw_parts(self.data, len as usize) },
108
+ }
109
110
+}
111
+
112
+impl AsRef<[u8]> for ngx_variable_value_t {
113
+ fn as_ref(&self) -> &[u8] {
114
+ self.as_bytes()
115
116
117
118
/// Returns the error code of the last failed operation (`errno`).
119
#[inline]
120
pub fn ngx_errno() -> ngx_err_t {
0 commit comments