Struct paho_mqtt::client_persistence::UserPersistence
source · [−]pub struct UserPersistence { /* private fields */ }
Expand description
A struct to wrap the user-defined client persistence objects for the C library, including the callback funtions from the C library. These functions receive the persistence callbacks from the C library and then pass them on to the user-supplied struct which implements the ClientPersistence trait.
Note that the C library does not keep a copy of the MQTTClient_persistence object, so the client must keep one and keep it at a consistent address. Thus it should be kept in a box on the heap.
Implementations
sourceimpl UserPersistence
impl UserPersistence
sourcepub fn new(persistence: ClientPersistenceType) -> UserPersistence
pub fn new(persistence: ClientPersistenceType) -> UserPersistence
Creates a new user persistence object.
sourcepub unsafe extern "C" fn on_open(
handle: *mut *mut c_void,
client_id: *const c_char,
server_uri: *const c_char,
context: *mut c_void
) -> c_int
pub unsafe extern "C" fn on_open(
handle: *mut *mut c_void,
client_id: *const c_char,
server_uri: *const c_char,
context: *mut c_void
) -> c_int
Callback from the C library to open the persistence store. On entry, the ‘context’ has the address of the user’s persistence object which is reassigned to the ‘handle’. Subsequent calls have the object address as the handle.
Safety
This is a callback directly from the C library. All parameters parameters must be checked for validity (NULL pointers, etc)
sourcepub unsafe extern "C" fn on_close(handle: *mut c_void) -> c_int
pub unsafe extern "C" fn on_close(handle: *mut c_void) -> c_int
Callback from the C library to close the persistence store.
Safety
This is a callback directly from the C library. All parameters parameters must be checked for validity (NULL pointers, etc)
sourcepub unsafe extern "C" fn on_put(
handle: *mut c_void,
key: *mut c_char,
bufcount: c_int,
buffers: *mut *mut c_char,
buflens: *mut c_int
) -> c_int
pub unsafe extern "C" fn on_put(
handle: *mut c_void,
key: *mut c_char,
bufcount: c_int,
buffers: *mut *mut c_char,
buflens: *mut c_int
) -> c_int
Callback from the C library to add data to the persistence store.
Safety
This is a callback directly from the C library. All parameters parameters must be checked for validity (NULL pointers, etc)
sourcepub unsafe extern "C" fn on_get(
handle: *mut c_void,
key: *mut c_char,
buffer: *mut *mut c_char,
buflen: *mut c_int
) -> c_int
pub unsafe extern "C" fn on_get(
handle: *mut c_void,
key: *mut c_char,
buffer: *mut *mut c_char,
buflen: *mut c_int
) -> c_int
Callback from the C library to retrieve data from the persistence store.
Safety
This is a callback directly from the C library. All parameters parameters must be checked for validity (NULL pointers, etc)
sourcepub unsafe extern "C" fn on_remove(
handle: *mut c_void,
key: *mut c_char
) -> c_int
pub unsafe extern "C" fn on_remove(
handle: *mut c_void,
key: *mut c_char
) -> c_int
Callback from the C library to delete specific data from the persistence store.
Safety
This is a callback directly from the C library. All parameters parameters must be checked for validity (NULL pointers, etc)
sourcepub unsafe extern "C" fn on_keys(
handle: *mut c_void,
keys: *mut *mut *mut c_char,
nkeys: *mut c_int
) -> c_int
pub unsafe extern "C" fn on_keys(
handle: *mut c_void,
keys: *mut *mut *mut c_char,
nkeys: *mut c_int
) -> c_int
Callback from the C library to retrieve the set of keys from the persistence store.
Safety
This is a callback directly from the C library. All parameters parameters must be checked for validity (NULL pointers, etc)
Auto Trait Implementations
impl !RefUnwindSafe for UserPersistence
impl !Send for UserPersistence
impl !Sync for UserPersistence
impl Unpin for UserPersistence
impl !UnwindSafe for UserPersistence
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more