Unsafe Rust - Complete Tutorial

Поділитися
Вставка
  • Опубліковано 25 лис 2024

КОМЕНТАРІ • 7

  • @codebreakthrough
    @codebreakthrough  10 місяців тому +1

    💰 FREE Software Dev Intro Course - calcur.tech/free-dev-course
    💯 FREE Courses (100+ hours) - calcur.tech/free-courses
    Timestamps:
    00:00 - Introduction
    02:08 -Create a Project
    03:33 - Converting from a Smart Pointer
    05:24 - Calling an Unsafe Function
    06:55 - Safe Interface
    07:47 - Modifying Mutable Statics
    09:18 - Unsafe Traits
    10:32 - Unions
    12:37 - Untagged Union
    12:58 - Tagged Union

  • @rafae5902
    @rafae5902 7 місяців тому

    IMHO, the existence of the unsafe block totally defeats the purpose of Rust existing.

    • @codebreakthrough
      @codebreakthrough  6 місяців тому

      You can force a project to not use unsafe, but sometimes it is required such as when interfacing with C

    • @rafae5902
      @rafae5902 6 місяців тому

      @@codebreakthrough Well, that's good to know, but I don't think it's enough. Maybe if you could configure your project to not allow unsafe mode not only in your own project's code, but also in any third party library and dependencies it used, then that would be better.
      I think rust devs pay too high a price for the borrow checker to still be exposed to unsafe code.
      Not worth it IMO.
      Something like Zig is better.

    • @dennisorbison7318
      @dennisorbison7318 5 місяців тому +3

      @@rafae5902 Zig shill spotted

    • @skkeye
      @skkeye Місяць тому

      unsafe rust is necessary for embedded programming as the very code runs on volatile memory (aka the mcu registers)

    • @skkeye
      @skkeye Місяць тому

      @@rafae5902 if you are doing IO, any kind, you are using unsafe code in the background