Visitar URL original
rustpython_vm - Rust
Skip to main content

Crate rustpython_vm

Crate rustpython_vm 

Source
Expand description

This crate contains most of the python logic.

  • Interpreter
  • Import mechanics
  • Base objects

Some stdlib modules are implemented here, but most of them are in the rustpython-stdlib module. The

Re-exports§

pub use self::convert::TryFromBorrowedObject;
pub use self::convert::TryFromObject;
pub use self::object::AsObject;
pub use self::object::Py;
pub use self::object::PyAtomicRef;
pub use self::object::PyExact;
pub use self::object::PyObject;
pub use self::object::PyObjectCell;
pub use self::object::PyObjectRef;
pub use self::object::PyPayload;
pub use self::object::PyRef;
pub use self::object::PyRefExact;
pub use self::object::PyResult;
pub use self::object::PyStackRef;
pub use self::object::PyWeakRef;
pub use self::vm::runtime;
pub use self::vm::Context;
pub use self::vm::InterpFeatureFlags;
pub use self::vm::Interpreter;
pub use self::vm::InterpreterBuilder;
pub use self::vm::InterpreterConfig;
pub use self::vm::InterpreterGil;
pub use self::vm::InterpreterInfo;
pub use self::vm::InterpreterWhence;
pub use self::vm::MAIN_INTERPRETER_ID;
pub use self::vm::Settings;
pub use self::vm::VirtualMachine;
pub use rustpython_common as common;
pub use rustpython_host_env as host_env;
pub use rustpython_literal as literal;

Modules§

buffer
builtins
This package contains the python basic/builtin types 7 common PyRef type aliases are exposed - PyBytesRef, PyDictRef, PyIntRef, PyListRef, PyStrRef, PyTypeRef, PyTupleRef Do not add more PyRef type aliases. They will be rare enough to use directly PyRef<T>.
byte
byte operation APIs
bytecode
Implement python as a virtual machine with bytecode. This module implements bytecode structure.
cformat
Implementation of Printf-Style string formatting as per the Python Docs.
class
Utilities to define a new Python class
compiler
convert
datastack
eval
exceptions
format
frame
frozen
function
gc_state
Garbage Collection State and Algorithm
getpath
Path configuration for RustPython (ref: Modules/getpath.py)
import
Import mechanics
iter
object
ospath
prelude
The prelude imports the various objects and traits.
protocol
py_io
readline
Readline interface for REPLs
recursion
scope
sequence
signal
sliceable
sorting
stdlib
suggestion
This module provides functionality to suggest similar names for attributes or variables. This is used during tracebacks.
types
utils
version
Version info constants.
vm
Implement virtual machine to run instructions.
warn

Macros§

atomic_func
class_or_notimplemented
define_methods
extend_class
extend_module
identifier
identifier_utf8
match_class
Macro to match on the built-in class of a Python object.
named_function
py_class
py_compile
py_freeze
py_namespace
raise_if_stop
Macro to handle PyIterReturn values in iterator implementations.
set_attrs
Macro to reduce code repetition when setting multiple attributes on an object.

Attribute Macros§

pyclass
The attribute can be applied either to a struct, trait, or impl.
pyexception
Helper macro to define Exception types. More-or-less is an alias to pyclass macro. A /// comment on the exception type is its docstring and overrides the stored documentation. Use // for developer notes.
pymodule
This attribute must be applied to an inline module. It defines a Python module in the form of a module_def function in the module; this has to be used in a add_native_module to properly register the module. Additionally, this macro defines ‘MODULE_NAME’ and ‘DOC’ in the module. A /// comment on the module is its docstring and overrides the stored module documentation. #[pyfunction] works the same way: its /// comment is the function docstring and overrides the stored function documentation. Use // for developer notes.
pystruct_sequence
Attribute macro for defining Python struct sequence types.
pystruct_sequence_data
Attribute macro for struct sequence Data structs.

Derive Macros§

FromArgs
Derive FromArgs for a struct whose fields are Python arguments.
PyPayload
Traverse
use on struct with named fields like struct A{x:PyRef<B>, y:PyRef<C>} to impl Traverse for datatype.