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::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::Context;pub use self::vm::Interpreter;pub use self::vm::InterpreterBuilder;pub use self::vm::Settings;pub use self::vm::VirtualMachine;pub use rustpython_common as common;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,PyTupleRefDo not add more PyRef type aliases. They will be rare enough to use directlyPyRef<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
- stdlib
- suggestion
- This module provides functionality to suggest similar names for attributes or variables. This is used during tracebacks.
- types
- utils
- version
- Several function to retrieve version information.
- 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
PyIterReturnvalues in iterator implementations.
Attribute Macros§
- pyclass
- The attribute can be applied either to a struct, trait, or impl.
- pyexception
- Helper macro to define
Exceptiontypes. More-or-less is an alias topyclassmacro. - pymodule
- This attribute must be applied to an inline module.
It defines a Python module in the form of a
module_deffunction in the module; this has to be used in aadd_native_moduleto properly register the module. Additionally, this macro defines ‘MODULE_NAME’ and ‘DOC’ in the module. - pystruct_
sequence - Attribute macro for defining Python struct sequence types.
- pystruct_
sequence_ data - Attribute macro for struct sequence Data structs.