mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-10 02:35:15 +08:00
![Mahmoud Al-Qudsi](/assets/img/avatar_default.png)
Rust doesn't have __FUNCTION__ or __func__ (though you can hack around it with a proc macro, but that will require a separate crate and slowing down compilation times with heavy proc macro dependencies), so these are just regular functions (at least for now). Rust's default stack trace on panic (even in release mode) should be enough (and the functions themselves are inlined so the calling function should be the second frame from the top, after the #[cold] panic functions).
29 lines
728 B
Rust
29 lines
728 B
Rust
/// Bridged functions concerned with initialization.
|
|
use crate::ffi::wcharz_t;
|
|
|
|
#[cxx::bridge]
|
|
mod ffi2 {
|
|
|
|
extern "C++" {
|
|
include!("wutil.h");
|
|
type wcharz_t = super::wcharz_t;
|
|
}
|
|
|
|
extern "Rust" {
|
|
fn rust_init();
|
|
fn rust_activate_flog_categories_by_pattern(wc_ptr: wcharz_t);
|
|
}
|
|
}
|
|
|
|
/// Entry point for Rust-specific initialization.
|
|
fn rust_init() {
|
|
crate::topic_monitor::topic_monitor_init();
|
|
crate::future_feature_flags::future_feature_flags_init();
|
|
crate::threads::init();
|
|
}
|
|
|
|
/// FFI bridge for activate_flog_categories_by_pattern().
|
|
fn rust_activate_flog_categories_by_pattern(wc_ptr: wcharz_t) {
|
|
crate::flog::activate_flog_categories_by_pattern(wc_ptr.into());
|
|
}
|