rune/runtime/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
//! Runtime module for Rune.

#[cfg(test)]
mod tests;

#[macro_use]
mod macros;

mod steps_between;
use self::steps_between::StepsBetween;

mod dynamic;
pub use self::dynamic::{DynamicEmpty, DynamicStruct, DynamicTuple};

mod access;
pub use self::access::AccessError;
pub(crate) use self::access::{Access, AccessErrorKind, RawAccessGuard, Snapshot};

mod borrow_mut;
pub use self::borrow_mut::BorrowMut;

mod borrow_ref;
pub use self::borrow_ref::BorrowRef;

mod any_obj;
use self::any_obj::AnyObjErrorKind;
pub use self::any_obj::{AnyObj, AnyObjError};
pub(crate) use self::any_obj::{AnyObjDrop, RawAnyObjGuard};

mod args;
pub use self::args::{Args, FixedArgs};
pub(crate) use self::args::{DynArgs, DynArgsUsed, DynGuardedArgs};

mod awaited;
pub(crate) use self::awaited::Awaited;

pub mod budget;

mod bytes;
pub use self::bytes::Bytes;

mod call;
pub use self::call::Call;

mod const_value;
pub use self::const_value::{
    from_const_value, to_const_value, ConstConstruct, ConstValue, FromConstValue, ToConstValue,
};
pub(crate) use self::const_value::{ConstContext, ConstValueKind, EmptyConstContext};

pub mod debug;
pub use self::debug::{DebugInfo, DebugInst};

mod env;

pub mod format;
pub use self::format::{Format, FormatSpec};

mod from_value;
#[allow(deprecated)]
pub use self::from_value::UnsafeFromValue;
pub use self::from_value::{from_value, FromValue, UnsafeToMut, UnsafeToRef};

mod function;
pub use self::function::{Function, SyncFunction};

mod future;
pub use self::future::Future;
pub(crate) use self::future::SelectFuture;

pub(crate) mod generator;
pub use self::generator::Generator;

mod generator_state;
pub use self::generator_state::GeneratorState;

mod guarded_args;
pub use self::guarded_args::GuardedArgs;

mod inst;
pub use self::inst::{
    Inst, InstAddress, InstArithmeticOp, InstBitwiseOp, InstOp, InstRange, InstShiftOp, InstTarget,
    InstValue, InstVariant, IntoOutput, Output, PanicReason, TypeCheck,
};

mod iterator;
pub use self::iterator::Iterator;

mod type_;
pub use self::type_::Type;

mod label;
pub use self::label::DebugLabel;
pub(crate) use self::label::Label;

pub(crate) mod object;
pub use self::object::Object;

mod panic;
pub(crate) use self::panic::{BoxedPanic, Panic};

mod protocol;
pub use self::protocol::Protocol;

mod protocol_caller;
pub(crate) use self::protocol_caller::{EnvProtocolCaller, ProtocolCaller};

pub(crate) mod range_from;
pub use self::range_from::RangeFrom;

mod range_full;
pub use self::range_full::RangeFull;

mod range_to_inclusive;
pub use self::range_to_inclusive::RangeToInclusive;

mod range_to;
pub use self::range_to::RangeTo;

pub(crate) mod range_inclusive;
pub use self::range_inclusive::RangeInclusive;

pub(crate) mod range;
pub use self::range::Range;

mod runtime_context;
pub(crate) use self::runtime_context::FunctionHandler;
pub use self::runtime_context::RuntimeContext;

mod select;
pub(crate) use self::select::Select;

mod r#ref;
use self::r#ref::RefVtable;
pub use self::r#ref::{Mut, RawAnyGuard, Ref};

mod stack;
pub(crate) use self::stack::Pair;
pub use self::stack::{Memory, SliceError, Stack, StackError};

mod static_string;
pub use self::static_string::StaticString;

mod stream;
pub use self::stream::Stream;

mod to_value;
pub use self::to_value::{to_value, ToReturn, ToValue, UnsafeToValue};

mod tuple;
pub use self::tuple::{OwnedTuple, Tuple};

mod type_info;
pub use self::type_info::{AnyTypeInfo, TypeInfo};

mod type_of;
pub use self::type_of::{MaybeTypeOf, TypeHash, TypeOf};

pub mod unit;
pub(crate) use self::unit::UnitFn;
pub use self::unit::{Unit, UnitStorage};

mod value;
pub use self::value::{
    Accessor, EmptyStruct, Inline, RawValueGuard, Rtti, Struct, TupleStruct, TypeValue, Value,
    ValueMutGuard, ValueRefGuard,
};
pub(crate) use self::value::{Dynamic, DynamicTakeError, Repr, RttiKind};

pub mod slice;

mod vec;
pub use self::vec::Vec;

mod vec_tuple;
pub use self::vec_tuple::VecTuple;

mod vm;
use self::vm::CallResultOnly;
pub use self::vm::{CallFrame, Isolated, Vm};

mod vm_call;
pub(crate) use self::vm_call::VmCall;

pub(crate) mod vm_diagnostics;
pub(crate) use self::vm_diagnostics::{VmDiagnostics, VmDiagnosticsObj};

mod vm_error;
#[cfg(feature = "emit")]
pub(crate) use self::vm_error::VmErrorAt;
pub use self::vm_error::{try_result, RuntimeError, TryFromResult, VmError, VmResult};
pub(crate) use self::vm_error::{VmErrorKind, VmIntegerRepr};

mod vm_execution;
pub(crate) use self::vm_execution::ExecutionState;
pub use self::vm_execution::{VmExecution, VmSendExecution};

mod vm_halt;
pub(crate) use self::vm_halt::{VmHalt, VmHaltInfo};

mod fmt;
pub use self::fmt::Formatter;

mod control_flow;
pub use self::control_flow::ControlFlow;

#[cfg(feature = "alloc")]
mod hasher;
#[cfg(feature = "alloc")]
pub use self::hasher::Hasher;

pub(crate) type FieldMap<K, V> = crate::alloc::HashMap<K, V>;

#[inline(always)]
pub(crate) fn new_field_map<K, V>() -> FieldMap<K, V> {
    FieldMap::new()
}

#[inline(always)]
pub(crate) fn new_field_hash_map_with_capacity<K, V>(
    cap: usize,
) -> crate::alloc::Result<FieldMap<K, V>> {
    FieldMap::try_with_capacity(cap)
}