Expand description
§ring-lang-rs
Rust bindings for the Ring programming language.
§Thread Safety
Ring has no GIL (Global Interpreter Lock). Threading works as follows:
- Separate states are independent: Multiple
ring_state_new()calls create isolated VMs - Shared state across threads: Use
ring_vm_runcodefromthread()which creates a per-thread VM that shares global scope with the main VM. Mutex protection is applied to globals, function hash table, variable hash table, and memory pool during thread creation/deletion. - Memory pool: Thread-safe only after calling
ring_vm_mutexfunctions()to register mutex callbacks, and only when using the threading API (ring_vm_runcodefromthread)
§Memory Safety
Most functions in this crate are thin wrappers around Ring’s C API. Callers must ensure:
- Pointers (
RingState,RingList,RingVM) are valid and non-null - Objects are not used after being deleted
ring_list_getstring_str()returns an ownedString(safe to store)ring_api_getstring_str()returns a reference valid only during the callback
Re-exports§
pub use api::*;pub use general::*;pub use item::*;pub use list::*;pub use state::*;pub use string::*;pub use vm::*;
Modules§
Macros§
- ring_
check_ cpointer - ring_
check_ list - ring_
check_ number - ring_
check_ paracount - ring_
check_ paracount_ range - ring_
check_ pointer - ring_
check_ string - ring_
error - ring_
func - ring_
get_ cpointer - ring_
get_ int - ring_
get_ list - ring_
get_ number - ring_
get_ pointer - ring_
get_ string - ring_
libinit - ring_
new_ list - ring_
ret_ cpointer - ring_
ret_ list - ring_
ret_ managed_ cpointer - ring_
ret_ number - ring_
ret_ string
Constants§
- RING_
API_ BADPARACOUNT - RING_
API_ BADPARALENGTH - RING_
API_ BADPARARANGE - RING_
API_ BADPARATYPE - RING_
API_ BADPARAVALUE - RING_
API_ EMPTYLIST - RING_
API_ INTERNALFAILURE - RING_
API_ MISS1PARA - RING_
API_ MISS2PARA - RING_
API_ MISS3PARA - RING_
API_ MISS4PARA - RING_
API_ NOTPOINTER - RING_
API_ NULLPOINTER - RING_
API_ RANGEEXCEEDED - RING_
CPOINTERSTATUS_ NOTASSIGNED - RING_
CPOINTER_ STATUS - RING_
OUTPUT_ RETLIST - RING_
OUTPUT_ RETLISTBYREF - RING_
OUTPUT_ RETNEWREF - RING_
VARVALUE_ FLOAT - RING_
VARVALUE_ INT - RING_
VAR_ NAME - RING_
VAR_ PRIVATEFLAG - RING_
VAR_ PVALUETYPE - RING_
VAR_ TYPE - RING_
VAR_ VALUE