You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/advanced/forward_refs.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,11 +21,11 @@ At inflation time, the string `"Node"` is resolved to the actual `Node` class. T
21
21
For the common case of a pointer to the enclosing struct, the legacy `ptr_to_self` syntax is also available:
22
22
23
23
```python
24
-
from libdestruct import struct, c_int, ptr_to_self
24
+
from libdestruct import struct, c_int, ptr, ptr_to_self
25
25
26
26
classNode(struct):
27
27
val: c_int
28
-
next: ptr_to_self
28
+
next: ptr =ptr_to_self()
29
29
```
30
30
31
31
This is equivalent to `ptr["Node"]` but doesn't require you to spell out the type name. The `ptr["TypeName"]` syntax is preferred as it is more explicit.
0 commit comments