summaryrefslogtreecommitdiff
path: root/src/rust/tor_util/ffi.rs
blob: 9a56309365c1dd8261ccf94bc66af3bbd5c0966b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//! FFI functions to announce Rust support during tor startup, only to be
//! called from C.
//!

use libc::c_char;
use tor_allocate::allocate_and_copy_string;

/// Returns a short string to announce Rust support during startup.
///
/// # Examples
/// ```c
/// char *rust_str = rust_welcome_string();
/// printf("%s", rust_str);
/// tor_free(rust_str);
/// ```
#[no_mangle]
pub extern "C" fn rust_welcome_string() -> *mut c_char {
    let rust_welcome = String::from("Tor is running with Rust integration. Please report \
                          any bugs you encouter.");
    allocate_and_copy_string(&rust_welcome)
}