Skip to main content

sGCJsonCallbacks

Struct sGCJsonCallbacks 

#[repr(C)]
pub struct sGCJsonCallbacks { pub getBool: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> bool>, pub getInt: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> i64>, pub getDouble: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> f64>, pub getString: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> *mut i8>, pub getArrayIdx: Option<unsafe extern "C" fn(sGCJsonObject, i64, *mut u32) -> sGCJsonObject>, pub getArrayLength: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> i64>, pub getObjectField: Option<unsafe extern "C" fn(sGCJsonObject, *const i8, *mut u32) -> sGCJsonObject>, pub getObjectSerialized: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> *mut i8>, pub freeString: Option<unsafe extern "C" fn(*const i8)>, pub data: sGCJsonObject, }
Expand description

@brief The JSON configuration data and parsing callbacks

This struct holds the JSON configuration data and the parsing callbacks that the plugin can use to parse the configuration.

Fields§

§getBool: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> bool>

@brief Parse a boolean from a JSON object

@param obj The JSON object @param result The result of the operation

§getInt: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> i64>

@brief Parse an integer from a JSON object

@param obj The JSON object @param result The result of the operation

§getDouble: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> f64>

@brief Parse a double from a JSON object

@param obj The JSON object @param result The result of the operation

§getString: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> *mut i8>

@brief Parse a string from a JSON object

@param obj The JSON object @param result The result of the operation @return The string parsed from the JSON object or NULL if an error occurred @note The plugin must call @ref freeString on the returned string if it is not null. Not doing so will result in a memory leak.

§getArrayIdx: Option<unsafe extern "C" fn(sGCJsonObject, i64, *mut u32) -> sGCJsonObject>

@brief Get an element from a JSON array

@param obj The JSON object @param idx The index of the element to get @param result The result of the operation @return The element at the specified index or NULL if an error occurred

§getArrayLength: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> i64>

@brief Get the length of a JSON array

@param obj The JSON object @param result The result of the operation @return The length of the array or -1 if an error occurred

§getObjectField: Option<unsafe extern "C" fn(sGCJsonObject, *const i8, *mut u32) -> sGCJsonObject>

@brief Get a field from a JSON object

@param obj The JSON object @param fieldName The name of the field to get @param result The result of the operation @return The field or NULL if an error occurred

§getObjectSerialized: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> *mut i8>

@brief Serialize a JSON object to a string

@param obj The JSON object @param result The result of the operation @return The serialized JSON object or NULL if an error occurred @note The plugin must call @ref freeString on the returned string if it is not null. Not doing so will result in a memory leak.

§freeString: Option<unsafe extern "C" fn(*const i8)>

@brief Free a string

Free a string returned by @ref getString or @ref getObjectSerialized.

@param str The string to free

§data: sGCJsonObject

@brief The plugin specific configuration

Represents the top level JSON object that contains the plugin specific configuration set by the user.

Trait Implementations§

§

impl Clone for sGCJsonCallbacks

§

fn clone(&self) -> sGCJsonCallbacks

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for sGCJsonCallbacks

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Copy for sGCJsonCallbacks

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.