Skip to main content

Crate rt

Crate rt 

Source

Modules§

boot
cpu
crash
fx
os
portable
Portable arithmetic, available on native targets for exact backend comparisons.
sync
x87

Macros§

app_version
The app’s own version: version= of apps/NAME/PACKAGE, which build_rs.py hands to rustc as JFGUI_VERSION (every program of the app); “0.0.0” without one. An expression of type &'static str: const APP_VERSION: &str = rt::app_version!();, update::Config::new(app, rt::app_version!(), ..).
main
(see above)
plugin_abi
The calling convention of plugins and modules: extern "win64" on x86-64, extern "C" elsewhere (docs/ARM64.md, decision 4). plugin_abi!(fn(u32) -> u32) is the type of such a function pointer; plugin_abi! { pub fn f(a: u32) -> u32 { a } } defines such a function (attributes, visibility, unsafe, generics and the body pass through unchanged).
test_main
(E16) the jfgui_main a program’s main! defines, for the test binary of a library crate with std and without main! (a style crate’s cargo test): plat’s start of a std program refers to it, so without it the tests do not link. Never called (the test harness has its own main); no panic check (tests unwind). #[cfg(test)] rt::test_main!(); in the crate’s lib.rs, also under #![forbid(unsafe_code)] (the expansion allows no lint: unsafe_code skips external macros). A crate with main! needs none: its main!’s jfgui_main links the tests

Structs§

Alloc
rt’s allocator, for a program with std that wants it instead of the system’s: #[global_allocator] static ALLOC: jflib::rt::Alloc = jflib::rt::Alloc::new();

Constants§

VERSION
the library’s version, “MAJOR.MINOR.PATCH” (the root Cargo.toml; docs/VERSIONING.md says what a change of each part promises). Not the app’s version: that is rt::app_version!().
VERSION_MAJOR
the first number of VERSION (incompatible API changes; while 0, the MINOR number counts them)
VERSION_MINOR
the second number of VERSION
VERSION_PATCH
the third number of VERSION

Functions§

abort_on_unwind
run f; with the feature unwind (a program with std built with panic = "unwind") a panic that leaves it ends the program as an uncaught panic: JFLib’s crash report, exit code 3. plat runs its threads and the program’s start through it. Without that feature a panic never unwinds, and this is f().
panic_hook
(feature std) std’s panics end as rt’s panic handler ends them without std: one line on stderr, the crash hook, exit code 3. plat’s start of a std program installs it; replacing it with std::panic::set_hook gives up JFLib’s crash report for panics. With the feature unwind and panic = "unwind" it reports only a panic nobody catches: one that leaves the program’s start or a thread of JFLib’s, or reaches a callback of the system ([abort_on_unwind]).