Summon Rust from Swift

Summon Rust from Swift

C114c127f13522da92cb03e5d14946ca?s=128

Takuma Shimizu

December 06, 2019
Tweet

Transcript

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

  2. 4VNNPO3VTU GSPN4XJGU

  3. 4XJGUQFSGPSNTGVODUJPOT XSJUUFOCZ3VTU

  4. )PX w 6TF3VTUT''*GFBUVSF w 'PSFJHO'VODUJPO*OUFSGBDF w &YQPSU3VTUDPEFTBT$DPEFT w GVODUJPOTBOETUSVDUT FUD

    w #SJEHFUIF$DPEFTJOUP4XJGU w FH 7JBCSJEHJOHIFBEFS I
  5. IUUQTHJUIVCDPNSB%J⒎FSFODF,JU

  6. IUUQTHJUIVCDPNSB%J⒎FSFODF,JU

  7. TUEDMPOF$MPOF 4XJGU w $MPOFUIFJNQMFNFOUBUJPOXSJUUFOCZ4XJGU w 4PpOJTIFE3VTUDPEFCBTFJT4XJGUZ w 6TFDMBTTFTBOETIBSFUIFJSJOTUBODFTCFUXFFO DPMMFDUJPOPCKFDUT w

    3FQSPEVDFTJNQMZUIFBCPWFXJUI3VTUCSJOHT PWFSIFBETBUSVOUJNF w #SJEHJOH4XJGUUP$NBZCFBCMFUPCFFYQFOTJWF
  8. %FNP

  9. Impl DeepDiff w 4IBSFJOTUBODFTPGBDMBTTCFUXFFO
 POFDictionaryBOEUXPArrayT w .VUBUFUIFJOTUBODFTUIBUUBLFGSPNUIF DictionaryBOEArrayT

  10. struct Rc<T> w 3FGFSFODF$PVOUFE w Arc<T>"VUPNBUJD"UPNJDBMMZ3FGFSFODF$PVOUFE w 4IBSFBWBMVFCFUXFFOUXPPSNPSFPXOFST w 3FBMJ[FGFBUVSFTMJLFBOJNNVUBCMFDMBTT

    w #SJOHPWFSIFBEBUSVOUJNF
  11. struct RefCell<T> • struct Cell<T> • Rc<RefCell<T>> w 3FBMJ[FGFBUVSFTMJLFBDMBTTNVUBUJPO w

    *O4XJGU BTJNJMBSUPBOPCKFDUPGBDMBTTTUPSFE CZletQSPQFSUZXJUIJOBTUSVDU w 1VUP⒎CPSSPXDIFDLVOUJMSVOUJNF w #SJOHPWFSIFBEBUSVOUJNF
  12. $CSJEHJOH w $PFSDJPO *NQMJDJUUZQFDPOWFSTJPO  • ⭕ String  Unsafe<CChar>

    • ⭕ Array<T>  UnsafePointer<T> • ❌ Array<String>
  UnsafePointer<UnsafePoint<CChar>> w "OZXBZUIFTFBSFFYQFOTJWF
  13. %FNP

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