binder_ndk_sys

Type Alias AParcel_stringAllocator

Source
pub type AParcel_stringAllocator = Option<unsafe extern "C" fn(stringData: *mut c_void, length: i32, buffer: *mut *mut c_char) -> bool>;
Expand description

This is called to allocate a buffer for a C-style string (null-terminated). The returned buffer should be at least length bytes. This includes space for a null terminator. For a string, length will always be strictly less than or equal to the maximum size that can be held in a size_t and will always be greater than 0. However, if a ‘null’ string is being read, length will be -1.

See also AParcel_readString.

If allocation fails, null should be returned.

\param stringData some external representation of a string \param length the length of the buffer needed to fill (including the null-terminator) \param buffer a buffer of size ‘length’ or null if allocation failed.

\return true if the allocation succeeded, false otherwise. If length is -1, a true return here means that a ‘null’ value (or equivalent) was successfully stored.

Aliased Type§

enum AParcel_stringAllocator {
    None,
    Some(unsafe extern "C" fn(_: *mut c_void, _: i32, _: *mut *mut i8) -> bool),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(_: *mut c_void, _: i32, _: *mut *mut i8) -> bool)

Some value of type T.