File tree Expand file tree Collapse file tree 3 files changed +56
-52
lines changed Expand file tree Collapse file tree 3 files changed +56
-52
lines changed Original file line number Diff line number Diff line change
1
+
2
+ #[ derive( PartialEq ) ]
3
+ #[ derive( Debug ) ]
4
+ pub struct Code {
5
+ pub argcount : u32 ,
6
+ pub kwonlyargcount : u32 ,
7
+ pub nlocals : u32 ,
8
+ pub stacksize : u32 ,
9
+ pub flags : u32 ,
10
+ pub code : Object ,
11
+ pub consts : Object ,
12
+ pub names : Object ,
13
+ pub varnames : Object ,
14
+ pub freevars : Object ,
15
+ pub cellvars : Object ,
16
+ pub filename : Object ,
17
+ pub name : Object ,
18
+ pub firstlineno : u32 ,
19
+ pub lnotab : Object ,
20
+ }
21
+
22
+ #[ derive( PartialEq ) ]
23
+ #[ derive( Debug ) ]
24
+ pub enum Object {
25
+ Hole , // Temporary object for unmarshalling
26
+ //Null,
27
+ None ,
28
+ False ,
29
+ True ,
30
+ //StopIter,
31
+ //Ellipsis,
32
+ Int ( u32 ) ,
33
+ //Float,
34
+ //BinaryFloat,
35
+ //Complex,
36
+ //BinaryComplex,
37
+ String ( :: std:: string:: String ) ,
38
+ //Interned,
39
+ //Ref_,
40
+ Tuple ( Vec < Object > ) ,
41
+ List ( Vec < Object > ) ,
42
+ //Dict,
43
+ Code ( Box < Code > ) ,
44
+ //Unknown,
45
+ Set ( Vec < Object > ) ,
46
+ FrozenSet ( Vec < Object > ) ,
47
+ Ref ( u32 ) ,
48
+
49
+ Bytes ( Vec < u8 > ) , // aka. ASCII in CPython's marshal
50
+ //ShortAscii,
51
+ //ShortAsciiInterned
52
+ }
Original file line number Diff line number Diff line change
1
+ pub mod common;
2
+ pub mod unmarshal;
Original file line number Diff line number Diff line change 1
1
use std:: fmt;
2
2
use std:: io;
3
- use std:: sync:: Arc ;
3
+
4
+ use super :: common:: { Object , Code } ;
4
5
5
6
#[ derive( Debug ) ]
6
7
pub enum UnmarshalError {
@@ -21,57 +22,6 @@ impl fmt::Display for UnmarshalError {
21
22
}
22
23
}
23
24
24
- #[ derive( PartialEq ) ]
25
- #[ derive( Debug ) ]
26
- struct Code {
27
- argcount : u32 ,
28
- kwonlyargcount : u32 ,
29
- nlocals : u32 ,
30
- stacksize : u32 ,
31
- flags : u32 ,
32
- code : Object ,
33
- consts : Object ,
34
- names : Object ,
35
- varnames : Object ,
36
- freevars : Object ,
37
- cellvars : Object ,
38
- filename : Object ,
39
- name : Object ,
40
- firstlineno : u32 ,
41
- lnotab : Object ,
42
- }
43
-
44
- #[ derive( PartialEq ) ]
45
- #[ derive( Debug ) ]
46
- pub enum Object {
47
- Hole , // Temporary object for unmarshalling
48
- //Null,
49
- None ,
50
- False ,
51
- True ,
52
- //StopIter,
53
- //Ellipsis,
54
- Int ( u32 ) ,
55
- //Float,
56
- //BinaryFloat,
57
- //Complex,
58
- //BinaryComplex,
59
- String ( :: std:: string:: String ) ,
60
- //Interned,
61
- //Ref_,
62
- Tuple ( Vec < Object > ) ,
63
- List ( Vec < Object > ) ,
64
- //Dict,
65
- Code ( Box < Code > ) ,
66
- //Unknown,
67
- Set ( Vec < Object > ) ,
68
- FrozenSet ( Vec < Object > ) ,
69
- Ref ( u32 ) ,
70
-
71
- Bytes ( Vec < u8 > ) , // aka. ASCII in CPython's marshal
72
- //ShortAscii,
73
- //ShortAsciiInterned
74
- }
75
25
76
26
macro_rules! read_byte {
77
27
( $r: expr ) => { {
You can’t perform that action at this time.
0 commit comments