mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-06-22 01:10:03 +00:00
58 lines
1.5 KiB
Rust
58 lines
1.5 KiB
Rust
|
|
// Generated by nim-ffi native Rust codegen. Do not edit by hand.
|
||
|
|
#![allow(non_snake_case, dead_code)]
|
||
|
|
use std::os::raw::{c_char, c_int, c_void};
|
||
|
|
|
||
|
|
pub type FFICallback =
|
||
|
|
unsafe extern "C" fn(ret: c_int, msg: *const c_char, len: usize, user_data: *mut c_void);
|
||
|
|
|
||
|
|
#[repr(C)]
|
||
|
|
#[derive(Clone, Copy)]
|
||
|
|
pub struct TimerConfig {
|
||
|
|
pub name: *const c_char,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[repr(C)]
|
||
|
|
#[derive(Clone, Copy)]
|
||
|
|
pub struct EchoRequest {
|
||
|
|
pub message: *const c_char,
|
||
|
|
pub delay_ms: i64,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[repr(C)]
|
||
|
|
#[derive(Clone, Copy)]
|
||
|
|
pub struct EchoResponse {
|
||
|
|
pub echoed: *const c_char,
|
||
|
|
pub timer_name: *const c_char,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[repr(C)]
|
||
|
|
#[derive(Clone, Copy)]
|
||
|
|
pub struct ComplexResponse {
|
||
|
|
pub summary: *const c_char,
|
||
|
|
pub item_count: i64,
|
||
|
|
pub has_note: c_int,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[repr(C)]
|
||
|
|
#[derive(Clone, Copy)]
|
||
|
|
pub struct EchoEvent {
|
||
|
|
pub message: *const c_char,
|
||
|
|
pub echo_count: i64,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[repr(C)]
|
||
|
|
#[derive(Clone, Copy)]
|
||
|
|
pub struct ScheduleResult {
|
||
|
|
pub job_id: *const c_char,
|
||
|
|
pub will_run_count: i64,
|
||
|
|
pub first_run_at_ms: i64,
|
||
|
|
pub effective_backoff_ms: i64,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[link(name = "my_timer")]
|
||
|
|
extern "C" {
|
||
|
|
pub fn my_timer_create(config: TimerConfig, callback: FFICallback, user_data: *mut c_void) -> *mut c_void;
|
||
|
|
pub fn my_timer_echo(ctx: *mut c_void, callback: FFICallback, user_data: *mut c_void, req: EchoRequest) -> c_int;
|
||
|
|
pub fn my_timer_version(ctx: *mut c_void, callback: FFICallback, user_data: *mut c_void) -> c_int;
|
||
|
|
pub fn my_timer_destroy(ctx: *mut c_void) -> c_int;
|
||
|
|
}
|