Skip to main content

StreamWrapper

Type Alias StreamWrapper 

Source
pub type StreamWrapper = php_stream_wrapper;
Expand description

Wrapper for PHP streams

Aliased Type§

#[repr(C)]
pub struct StreamWrapper { pub wops: *const _php_stream_wrapper_ops, pub abstract_: *mut c_void, pub is_url: i32, }

Fields§

§wops: *const _php_stream_wrapper_ops§abstract_: *mut c_void§is_url: i32

Implementations§

Source§

impl StreamWrapper

Source

pub unsafe fn get<'a>(name: &str) -> Option<&'a Self>

Locates the stream wrapper registered for name.

§Safety

The returned wrapper is owned by PHP and lives in the per-request stream wrapper table, so the caller must not hold 'a beyond the current request. The lifetime is unconstrained by the arguments and must be chosen to reflect that.

Source

pub unsafe fn get_mut<'a>(name: &str) -> Option<&'a mut Self>

Locates the stream wrapper registered for name for mutation.

§Safety

In addition to the request-scoped validity required by Self::get, the caller must ensure no other reference to the same wrapper is live for 'a. The wrapper table is process-wide state shared with PHP and with every other extension, so this function cannot check exclusivity.

Source

pub fn register(self, name: &str) -> Result<Self, Error>

Register stream wrapper for name

§Errors
  • Error::StreamWrapperRegistrationFailure - If the stream wrapper could not be registered
  • Error::InvalidCString - If the name contains a NUL byte
Source

pub fn register_volatile(self, name: &str) -> Result<Self, Error>

Register volatile stream wrapper for name

§Errors
  • Error::StreamWrapperRegistrationFailure - If the stream wrapper could not be registered
Source

pub fn unregister(name: &str) -> Result<(), Error>

Unregister stream wrapper by name

§Errors
  • Error::StreamWrapperUnregistrationFailure - If the stream wrapper could not be unregistered
  • Error::InvalidCString - If the name contains a NUL byte
Source

pub fn unregister_volatile(name: &str) -> Result<(), Error>

Unregister volatile stream wrapper by name

§Errors
  • Error::StreamWrapperUnregistrationFailure - If the stream wrapper could not be unregistered
Source

pub fn wops(&self) -> &php_stream_wrapper_ops

Get the operations the stream wrapper can perform

Source

pub fn wops_mut(&mut self) -> &mut php_stream_wrapper_ops

Get the mutable operations the stream can perform