Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Summon Rust from Swift

Summon Rust from Swift

Takuma Shimizu

December 06, 2019
Tweet

More Decks by Takuma Shimizu

Other Decks in Programming

Transcript

  1. 4VNNPO3VTU
    GSPN4XJGU
    4)*.*;65BLVNB
    !IPLVSPO

    View full-size slide

  2. 4VNNPO3VTU
    GSPN4XJGU

    View full-size slide

  3. 4XJGUQFSGPSNTGVODUJPOT
    XSJUUFOCZ3VTU

    View full-size slide

  4. )PX
    w 6TF3VTUT''*GFBUVSF
    w 'PSFJHO'VODUJPO*OUFSGBDF
    w &YQPSU3VTUDPEFTBT$DPEFT
    w GVODUJPOTBOETUSVDUT FUD
    w #SJEHFUIF$DPEFTJOUP4XJGU
    w FH 7JBCSJEHJOHIFBEFS I

    View full-size slide

  5. IUUQTHJUIVCDPNSB%J⒎FSFODF,JU

    View full-size slide

  6. IUUQTHJUIVCDPNSB%J⒎FSFODF,JU

    View full-size slide

  7. TUEDMPOF$MPOF 4XJGU

    w $MPOFUIFJNQMFNFOUBUJPOXSJUUFOCZ4XJGU
    w 4PpOJTIFE3VTUDPEFCBTFJT4XJGUZ
    w 6TFDMBTTFTBOETIBSFUIFJSJOTUBODFTCFUXFFO
    DPMMFDUJPOPCKFDUT
    w 3FQSPEVDFTJNQMZUIFBCPWFXJUI3VTUCSJOHT
    PWFSIFBETBUSVOUJNF
    w #SJEHJOH4XJGUUP$NBZCFBCMFUPCFFYQFOTJWF

    View full-size slide

  8. Impl DeepDiff
    w 4IBSFJOTUBODFTPGBDMBTTCFUXFFO

    POFDictionaryBOEUXPArrayT
    w .VUBUFUIFJOTUBODFTUIBUUBLFGSPNUIF
    DictionaryBOEArrayT

    View full-size slide

  9. struct Rc
    w 3FGFSFODF$PVOUFE
    w Arc"VUPNBUJD"UPNJDBMMZ3FGFSFODF$PVOUFE
    w 4IBSFBWBMVFCFUXFFOUXPPSNPSFPXOFST
    w 3FBMJ[FGFBUVSFTMJLFBOJNNVUBCMFDMBTT
    w #SJOHPWFSIFBEBUSVOUJNF

    View full-size slide

  10. struct RefCell
    • struct Cell
    • Rc>
    w 3FBMJ[FGFBUVSFTMJLFBDMBTTNVUBUJPO
    w *O4XJGU BTJNJMBSUPBOPCKFDUPGBDMBTTTUPSFE
    CZletQSPQFSUZXJUIJOBTUSVDU
    w 1VUP⒎CPSSPXDIFDLVOUJMSVOUJNF
    w #SJOHPWFSIFBEBUSVOUJNF

    View full-size slide

  11. $CSJEHJOH
    w $PFSDJPO *NQMJDJUUZQFDPOWFSTJPO

    • ⭕ String Unsafe
    • ⭕ Array UnsafePointer
    • ❌ Array

    UnsafePointer>
    w "OZXBZUIFTFBSFFYQFOTJWF

    View full-size slide

  12. 3FDBQ
    w 3VTUJTDBQBCMFPG''*
    w ''*FYQPSUT$JOUFSGBDF
    w 4XJGUVTFTUIF$JOUFSGBDF
    w 3VTUJTWFSZGBTU FWFOUIPVHIOPU4XJGUZ3VTU

    View full-size slide