Enum glean_ffi::upload::FfiPingUploadTask
source · [−]#[repr(u8)]
pub enum FfiPingUploadTask {
Upload {
document_id: *mut c_char,
path: *mut c_char,
body: ByteBuffer,
headers: *mut c_char,
},
Wait(u64),
Done,
}
Expand description
A FFI-compatible representation for the PingUploadTask.
This is exposed as a C-compatible tagged union, like this:
enum FfiPingUploadTask_Tag {
FfiPingUploadTask_Upload,
FfiPingUploadTask_Wait,
FfiPingUploadTask_Done,
};
typedef uint8_t FfiPingUploadTask_Tag;
typedef struct {
FfiPingUploadTask_Tag tag;
char *document_id;
char *path;
char *body;
char *headers;
} FfiPingUploadTask_Upload_Body;
typedef union {
FfiPingUploadTask_Tag tag;
FfiPingUploadTask_Upload_Body upload;
} FfiPingUploadTask;
It is therefore always valid to read the tag
field of the returned union (always the first
field in memory).
Language bindings should turn this into proper language types (e.g. enums/structs) and copy out data.
String fields are encoded into null-terminated UTF-8 C strings.
- The language binding should copy out the data and turn these into their equivalent string type.
- The language binding should not free these fields individually.
Instead
glean_process_ping_upload_response
will receive the whole enum, taking care of freeing the memory.
The order of variants should be the same as in glean-core/src/upload/mod.rs
and glean-core/android/src/main/java/mozilla/telemetry/glean/net/Upload.kt
.
cbindgen:prefix-with-name
Variants
Upload
Wait(u64)
Done
Trait Implementations
sourceimpl Drop for FfiPingUploadTask
impl Drop for FfiPingUploadTask
sourceimpl From<PingUploadTask> for FfiPingUploadTask
impl From<PingUploadTask> for FfiPingUploadTask
sourcefn from(task: PingUploadTask) -> Self
fn from(task: PingUploadTask) -> Self
Converts to this type from the input type.
sourceimpl IntoFfi for FfiPingUploadTask
impl IntoFfi for FfiPingUploadTask
type Value = FfiPingUploadTask
type Value = FfiPingUploadTask
This type must be: Read more
sourcefn ffi_default() -> FfiPingUploadTask
fn ffi_default() -> FfiPingUploadTask
Return an ‘empty’ value. This is what’s passed back to C in the case of an error,
so it doesn’t actually need to be “empty”, so much as “ignorable”. Note that this
is also used when an empty Option<T>
is returned. Read more
sourcefn into_ffi_value(self) -> FfiPingUploadTask
fn into_ffi_value(self) -> FfiPingUploadTask
Convert ourselves into a value we can pass back to C with confidence.
Auto Trait Implementations
impl RefUnwindSafe for FfiPingUploadTask
impl !Send for FfiPingUploadTask
impl !Sync for FfiPingUploadTask
impl Unpin for FfiPingUploadTask
impl UnwindSafe for FfiPingUploadTask
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