Crate janetrs[−][src]
Expand description
Janetrs
A crate with high level bindings to Janet C API.
Goals
Provide a safe and ergonomic interface to the Janet C API to create Janet clients and Janet modules/libraries using Rust.
This project still are in it’s early stages, so breaking changes may happen, there is no minimal supported Rust version (MSRV) yet.
Notice that most doc tests will fail if the feature “almagation” or “link-system” aren’t set, because most of then need it for the Janet runtime to function properly.
Cargo Features
std
: Enable some trait impl for types that only exist on thestd
and the Error traitunicode
: Enable more methods for JanetString and JanetBufferinline-more
: More agressive inliningamalgation
: Link the Janet runtime to the package, enabling to use the client moduleunicode
: Enable some unicode methods for JanetString and JanetBuffersystem
: Use system header to get Janet functionslink-system
: Link the Janet runtime to the package from the system, enabling to use the client modulenightly
: Enable some parts of the crate that uses nightly features, to use this feature you must compile the crate using a nightly rust version
Environment variables
These variables are only used when the amalgation
feature is enabled
It is possible to use environment variables to overwrite some Janet definitions.
JANET_RECURSION_GUARD=<integer>
JANET_MAX_PROTO_DEPTH=<integer>
JANET_MAX_MACRO_EXPAND=<integer>
JANET_STACK_MAX=<integer>
Licensing
This software is licensed under the terms of the MIT Public License.
TODO: Types/Traits: Lacking or Incomplete
- Marshaling
[ ]: Lacking
[I]: Incomplete
[X]: Done
Probably there is much more missing, for that you can use the
lowlevel
module to access the raw C API of Janet if needed
TODO: Lib level
- Better docs.
- Marshalling mechanism
Re-exports
pub use evil_janet as lowlevel; |
Modules
allocator | This module provides a allocator that uses the Janet scratch memory API to create objects tracked by the Janet Garbage Collector. |
array | Janet array (vector) type. |
buffer | Janet buffer (string) type. |
client | This module implements anything required to run a Janet client. |
env | |
fiber | Janet fibers (soft threads) type. |
function | Janet function types. |
janet_abstract | Module of the JanetAbstract abstractions. |
pointer | Module for the Janet Pointer type. |
string | Janet String type. |
structs | Janet Struct (immutable HashMap) type. |
symbol | Janet symbols and keywords types. |
table | Janet table (mutable HashMap) type. |
tuple | Janet tuple type. |
util | Module for stuff that are not required either to use in a application or to write janet modules. |
Macros
array | Creates a |
janet_mod | A macro to make life easier creating modules for Janet from Rust. |
jcatch | Execute a |
jpanic | Causes a panic in the Janet side. Diferently of the Rust |
jtry | Macro that tries to run a expression, and if it panics in Rust side, it tries to recover from that and pass the Rust panic string to a Janet Panic. |
structs | Creates a |
table | Creates a |
tuple | Creates a |
Structs
Janet |
|
JanetAbstract | Type that represents the Janet Abstract type. |
JanetArray | Janet arrays are a fundamental datatype in Janet. Janet Arrays are values that contain a sequence of other values. |
JanetBuffer | Janet buffers are the mutable
version of |
JanetConversionError | The error when converting |
JanetFiber | A lightweight green thread in Janet. It does not correspond to operating system threads. |
JanetFunction | A representation of a Janet function defined at the Janet side. |
JanetGc | The Janet Garbage Collector type. |
JanetGcLockGuard | An RAII implementation of a “scoped lock” of the Janet GC. When this structure is dropped (falls out of scope), the lock will be unlocked. |
JanetGcRootGuard | An RAII implementation of a rooted |
JanetKeyword | Janet keyword. Janet being a lisp-like language a keyword is not a especial word of the language, it is a normal string that can be defined by the user. |
JanetPointer | Janet pointer type. |
JanetString | Janet strings are a immutable type that are similar to Janet buffers. |
JanetStruct |
|
JanetSymbol | Janet symbol type. Usually used to name things in Janet. |
JanetTable | Janet tables are mutable data structures that map keys to values. Values are put into a Janet table with a key, and can be looked up later with the same key. Tables are implemented with an underlying open hash table, so they are quite fast and cache friendly. |
JanetTuple | Janet tuples are immutable, sequential types that are similar to Janet arrays. |
Enums
JanetSignal | Signals that can be produced by a |
JanetType | Representation of all Janet types. |
TaggedJanet | Janet type in the form of a Tagged Union. |
Traits
DeepEq | A trait to express a deep equality. |
IsJanetAbstract | The trait that encodes the information required to instatiate the implementer as
|
JanetExtend | Trait that express the ability of a Janet collection to extend it with another collection. |
Type Definitions
JanetCFunction | C function pointer that is accepted by Janet as a type. |
Attribute Macros
cjvg | Conditional Janet Version Gate |
janet_fn | Usage: |
janet_version | Conditional Janet Version Gate |