atc_router::ffi::schema

Function schema_add_field

Source
#[no_mangle]
pub unsafe extern "C" fn schema_add_field(
    schema: &mut Schema,
    field: *const i8,
    typ: Type,
)
Expand description

Add a new field with the specified type to the schema.

§Arguments

  • schema: a valid pointer to the Schema object returned by schema_new.
  • field: the C-style string representing the field name.
  • typ: the type of the field.

§Panics

This function will panic if the C-style string pointed by field is not a valid UTF-8 string.

§Safety

Violating any of the following constraints will result in undefined behavior:

  • schema must be a valid pointer returned by schema_new.
  • field must be a valid pointer to a C-style string, must be properly aligned, and must not have ‘\0’ in the middle.