Crate python_marshal

Source

Modules§

code_objects
error
magic
resolver

Macros§

extract_object
Extracts an object from a result, matching it against a specific variant. If the object matches the variant, it will return this. Otherwise, it returns an error.
extract_strings_dict
Extracts a hashmap of string keys and string values from a dictionary of objects.
extract_strings_frozenset
Extracts a vector of string objects from a frozen set of objects.
extract_strings_list
Extracts a vector of string objects from a list of objects.
extract_strings_set
Extracts a vector of string objects from a set of objects.
extract_strings_tuple
Extracts a vector of string objects from a tuple of objects, resolving references if necessary.
resolve_object_ref
Resolves an object ref if the object is a reference (LoadRef or StoreRef). If not, it returns the object itself.

Structs§

CodeFlags
Represents the flags that can be set on a code object.
PyString
Represents a Python string object. Python supports many kinds of strings, this is why we use BString to represent the value. It is basically a Vec with some additional methods/traits.
PycFile
Represents a Python .pyc file, which contains a marshaled Python object along with metadata such as the Python version, timestamp, and hash.

Enums§

Code
Kind
Represents the kind of object that is used in the Python marshal format. It is the first byte of each object in the marshal format.
Object
Represents a Python object. A marshal file exists of a single object, which can contain other objects.
ObjectHashable
Represents a hashable Object. It is used in Dicts, Sets, and FrozenSets.

Functions§

dump_bytes
Dumps a Python object to a byte vector. Behaves like marshal.dumps in Python.
dump_pyc
Dumps a PycFile to a byte stream, writing the magic number, timestamp, hash, and the marshaled object.
load_bytes
Load a Python object from a byte slice, returning the object and its references. Behaves like marshal.loads in Python.
load_pyc
Load a Python .pyc file from a byte stream, returning a PycFile struct.
minimize_references
Represent the marshal data in the most efficient way possible. Add references to every object and then optimize them.
optimize_references
Remove all unused references
unite_references
Unite duplicate references