FfiPingUploadTask

Enum 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

Fields

§document_id: *mut c_char
§headers: *mut c_char
§

Wait(u64)

§

Done

Trait Implementations§

Source§

impl Drop for FfiPingUploadTask

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<PingUploadTask> for FfiPingUploadTask

Source§

fn from(task: PingUploadTask) -> Self

Converts to this type from the input type.
Source§

impl IntoFfi for FfiPingUploadTask

Source§

type Value = FfiPingUploadTask

This type must be: Read more
Source§

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.
Source§

fn into_ffi_value(self) -> FfiPingUploadTask

Convert ourselves into a value we can pass back to C with confidence.

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> 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, 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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,