Struct ext_php_rs::bindings::_zend_string [−][src]
#[repr(C)]pub struct _zend_string {
pub gc: zend_refcounted_h,
pub h: zend_ulong,
pub len: size_t,
pub val: [c_char; 1],
}
Fields
gc: zend_refcounted_h
h: zend_ulong
len: size_t
val: [c_char; 1]
Implementations
Creates a new Zend string from a str
.
Parameters
str
- String content.persistent
- Whether the string should persist through the request boundary.
Returns
Returns a result containing the Zend string if successful. Returns an error if the given string contains NUL bytes, which cannot be contained inside a C string.
Panics
Panics if the function was unable to allocate memory for the Zend string.
Creates a new Zend string from a CStr
.
Parameters
str
- String content.persistent
- Whether the string should persist through the request boundary.
Panics
Panics if the function was unable to allocate memory for the Zend string.
Creates a new interned Zend string from a str
.
An interned string is only ever stored once and is immutable. PHP stores the string in an internal hashtable which stores the interned strings.
As Zend hashtables are not thread-safe, a mutex is used to prevent two interned strings from being created at the same time.
Parameters
str
- String content.persistent
- Whether the string should persist through the request boundary.
Returns
Returns a result containing the Zend string if successful. Returns an error if the given string contains NUL bytes, which cannot be contained inside a C string.
Panics
Panics if the function was unable to allocate memory for the Zend string.
Creates a new interned Zend string from a CStr
.
An interned string is only ever stored once and is immutable. PHP stores the string in an internal hashtable which stores the interned strings.
As Zend hashtables are not thread-safe, a mutex is used to prevent two interned strings from being created at the same time.
Parameters
str
- String content.persistent
- Whether the string should persist through the request boundary.
Panics
Panics under the following circumstances:
- The function used to create interned strings has not been set.
- The function could not allocate enough memory for the Zend string.
Returns a reference to the underlying CStr
inside the Zend string.