_cef_resource_handler_t

Struct _cef_resource_handler_t 

Source
#[repr(C)]
pub struct _cef_resource_handler_t { pub base: cef_base_ref_counted_t, pub open: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, request: *mut _cef_request_t, handle_request: *mut c_int, callback: *mut _cef_callback_t) -> c_int>, pub process_request: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, request: *mut _cef_request_t, callback: *mut _cef_callback_t) -> c_int>, pub get_response_headers: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, response: *mut _cef_response_t, response_length: *mut i64, redirectUrl: *mut cef_string_t)>, pub skip: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, bytes_to_skip: i64, bytes_skipped: *mut i64, callback: *mut _cef_resource_skip_callback_t) -> c_int>, pub read: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, data_out: *mut c_void, bytes_to_read: c_int, bytes_read: *mut c_int, callback: *mut _cef_resource_read_callback_t) -> c_int>, pub read_response: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, data_out: *mut c_void, bytes_to_read: c_int, bytes_read: *mut c_int, callback: *mut _cef_callback_t) -> c_int>, pub cancel: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t)>, }
Expand description

Structure used to implement a custom request handler structure. The functions of this structure will be called on the IO thread unless otherwise indicated.

NOTE: This struct is allocated client-side.

Fields§

§base: cef_base_ref_counted_t

Base structure.

§open: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, request: *mut _cef_request_t, handle_request: *mut c_int, callback: *mut _cef_callback_t) -> c_int>

Open the response stream. To handle the request immediately set |handle_request| to true (1) and return true (1). To decide at a later time set |handle_request| to false (0), return true (1), and execute |callback| to continue or cancel the request. To cancel the request immediately set |handle_request| to true (1) and return false (0). This function will be called in sequence but not from a dedicated thread. For backwards compatibility set |handle_request| to false (0) and return false (0) and the ProcessRequest function will be called.

§process_request: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, request: *mut _cef_request_t, callback: *mut _cef_callback_t) -> c_int>

Begin processing the request. To handle the request return true (1) and call cef_callback_t::cont() once the response header information is available (cef_callback_t::cont() can also be called from inside this function if header information is available immediately). To cancel the request return false (0).

WARNING: This function is deprecated. Use Open instead.

§get_response_headers: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, response: *mut _cef_response_t, response_length: *mut i64, redirectUrl: *mut cef_string_t)>

Retrieve response header information. If the response length is not known set |response_length| to -1 and read_response() will be called until it returns false (0). If the response length is known set |response_length| to a positive value and read_response() will be called until it returns false (0) or the specified number of bytes have been read. Use the |response| object to set the mime type, http status code and other optional header values. To redirect the request to a new URL set |redirectUrl| to the new URL. |redirectUrl| can be either a relative or fully qualified URL. It is also possible to set |response| to a redirect http status code and pass the new URL via a Location header. Likewise with |redirectUrl| it is valid to set a relative or fully qualified URL as the Location header value. If an error occured while setting up the request you can call set_error() on |response| to indicate the error condition.

§skip: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, bytes_to_skip: i64, bytes_skipped: *mut i64, callback: *mut _cef_resource_skip_callback_t) -> c_int>

Skip response data when requested by a Range header. Skip over and discard |bytes_to_skip| bytes of response data. If data is available immediately set |bytes_skipped| to the number of bytes skipped and return true (1). To read the data at a later time set |bytes_skipped| to 0, return true (1) and execute |callback| when the data is available. To indicate failure set |bytes_skipped| to < 0 (e.g. -2 for ERR_FAILED) and return false (0). This function will be called in sequence but not from a dedicated thread.

§read: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, data_out: *mut c_void, bytes_to_read: c_int, bytes_read: *mut c_int, callback: *mut _cef_resource_read_callback_t) -> c_int>

Read response data. If data is available immediately copy up to |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of bytes copied, and return true (1). To read the data at a later time keep a pointer to |data_out|, set |bytes_read| to 0, return true (1) and execute |callback| when the data is available (|data_out| will remain valid until the callback is executed). To indicate response completion set |bytes_read| to 0 and return false (0). To indicate failure set |bytes_read| to < 0 (e.g. -2 for ERR_FAILED) and return false (0). This function will be called in sequence but not from a dedicated thread. For backwards compatibility set |bytes_read| to -1 and return false (0) and the ReadResponse function will be called.

§read_response: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t, data_out: *mut c_void, bytes_to_read: c_int, bytes_read: *mut c_int, callback: *mut _cef_callback_t) -> c_int>

Read response data. If data is available immediately copy up to |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of bytes copied, and return true (1). To read the data at a later time set |bytes_read| to 0, return true (1) and call cef_callback_t::cont() when the data is available. To indicate response completion return false (0).

WARNING: This function is deprecated. Use Skip and Read instead.

§cancel: Option<unsafe extern "C" fn(self_: *mut _cef_resource_handler_t)>

Request processing has been canceled.

Trait Implementations§

Source§

impl Clone for _cef_resource_handler_t

Source§

fn clone(&self) -> _cef_resource_handler_t

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for _cef_resource_handler_t

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for _cef_resource_handler_t

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.