Skip to content

Instantly share code, notes, and snippets.

View gilescope's full-sized avatar

Squirrel gilescope

View GitHub Profile

Linking my account gilescope on GitHub with my address 0xef4abc185aee1c78bbae3b5c29a36c21b93f6323 on EVM in mycryptoprofile.io, and the challenge code is: 0441decb7ea4219541a3a39a41027c5b. #LitentryVerifyMyAddress

@gilescope
gilescope / pyo3types.md
Created July 9, 2020 10:25
pyo3 types
Py<PyList> (These are python PyNativeTypes)      <--- into() ---- PyList
    |                                                                 |  (deref/as_ref() )
   \/                                                                \/
PyObject   ------------------------------------- as_ref(py) -----> &PyAny (This links it with a 'py gil lock)
    ^ (clone_ref is a cheap clone)                                    ^
    | .into()                                                         | (deref/as_ref() or .downcast() to go the other way)
    |                                                                 |
Py<MyRustStruct> (These are rust PyClass)                         &PyCell<MyRustStruct>  -- try borrow ------> PyRef<MyRustClass> ----- extract() --> &MyRustClass
 | .as_ref(py) -- try borrow_mut --&gt; PyRefMut -- extract() --&gt; &amp;mut MyRustClass