Rust is a systems programming language focused on three goals: safety, speed, and concurrency. It is open source and provides top-tier performance like C/C++ while ensuring memory safety and preventing issues like memory leaks through its ownership and borrowing model that is checked at compile time. Rust also supports features like enums, pattern matching, generics, traits, and has a built-in test system to help ensure correctness.
An introduction to Rust: the modern programming language to develop safe and ...Claudio Capobianco
Rust is a young programming language developed by Mozilla with the open source community support. According to a survey of StackOverflow, in 2016 was the most loved among developers language! The goal of Rust is to combine control and performances, that is, operate at low level with high-level constructs. The actual applications vary from operating system to web development. Rust natively includes tools for Agile development, such as dependency management, testing and much more. The gap with other popular languages is filling up quickly thanks to the community, very active and fantastic :)
In this introductory presentation we will discuss the characteristics that make Rust unique, including the concepts of Ownership, Borrowing, and Lifetimes.
These slide has be presented for a talk in BIC Lazio Casilina, that has been also the first meetup of Rust Rome!
Rust
Why do you care about Rust? Who has the time to learn all these new languages? It seems like a new one is popping up every other week and this trend is growing at an exponential rate. Good news, a fair number of them are crafted really well and efficiently solve specific problems. Bad news, how do you keep up with all of this, let alone decide which languages to include in your companies technology portfolio.
Despite the challenges of all these new languages, a majority of developers are intrigued about the idea of becoming a polyglot, but don't know where to begin or don't have the time. In my polyglot travels, there is one language of late that is the sure-fire answer to the above questions, Rust.
In this talk I’ll explore the value behind becoming more polyglotic as a developer, how to pick languages to learn, and then dive deep in the the language of Rust. Which in my opinion, is hands down the best up and coming languages to learn.
About the Presenter
Anthony Broad-Crawford has been a developer since the year 2000 with a short side stint as a semi-professional poker player. Since his transition to software development Anthony has...
1. Built 8 patent receiving technologies
2. Founded two global companies
3. Been a CTO (3x), CPO (1x), and CEO (1x)
and is currently the CTO at Fooda where he manages product, user experience, and engineering. Fooda is predominantly web and mobile technology company focused on bringing great & healthy food from the best restaurant's to people while at the office.
Through his career, in production applications Anthony has used Ruby, Java, Jave (Android), Objective-C and Swift, .NET, Erlang, Scala, Node.JS, LISP, Smalltalk, and even assembly, with his recent favorite, Rust . No, not all at the same time in the same application.
Anthony now spends his time building great teams, that leverage great technology, to build great products, but still looks to codes every chance he can get :)
This document discusses why Rust is a useful programming language. It provides an introduction to Rust, highlighting its memory safety features, ownership and borrowing system, and functional programming aspects like iterators and closures. Examples are given to demonstrate how Rust prevents common bugs like dangling pointers and iterator invalidation. The talk also covers Rust's type system, enums, patterns matching, and its Cargo package manager.
Brief overview of the Rust system programming language. Provides a concise introduction of its basic features, with an emphasis on its memory safety features (ownership, moves, borrowing) and programming style with generic functions, structures, and traits.
Rust Tutorial | Rust Programming Language Tutorial For Beginners | Rust Train...Edureka!
( ** Edureka Online Training: https://www.edureka.co/ ** )
This video on Rust Programming Language will help you understand basics of Rust programming. The following topics will be covered in this tutorial:
1. Why learn Rust?
2. What is Rust?
3. Install Rust
4. Rust Fundamentals
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
This document introduces Rust and provides an overview of its key concepts. It begins with an introduction to the presenter and agenda. It then covers basic terminology, common system programming errors, why Rust was created, how to install Rust, data types including primitive types, complex data structures, ownership and borrowing rules, lifetimes, and how to get involved in the Rust community. Key concepts discussed include Rust's type system, memory safety features, and package manager.
- InfoQ is a news and community site for software developers with 750,000 unique visitors per month publishing content in 4 languages.
- It posts content from QCon conferences including news, articles, presentations, interviews and books to empower software development through spreading knowledge and innovation.
- QCon conferences are practitioner-driven and designed for influencers of change and innovation, connecting them and catalyzing innovation, and have been attended by over 12,000 delegates since 2007 across 9 cities worldwide.
Rust is a systems programming language developed by Mozilla that provides memory safety without garbage collection. It uses concepts of ownership and borrowing to ensure memory safety issues like use-after-free do not occur. Rust offers zero-cost abstractions meaning abstraction mechanisms like generics have little to no performance overhead. It allows high levels of concurrency but requires memory references be valid during their entire lifetime.
An introduction to Rust: the modern programming language to develop safe and ...Claudio Capobianco
Rust is a young programming language developed by Mozilla with the open source community support. According to a survey of StackOverflow, in 2016 was the most loved among developers language! The goal of Rust is to combine control and performances, that is, operate at low level with high-level constructs. The actual applications vary from operating system to web development. Rust natively includes tools for Agile development, such as dependency management, testing and much more. The gap with other popular languages is filling up quickly thanks to the community, very active and fantastic :)
In this introductory presentation we will discuss the characteristics that make Rust unique, including the concepts of Ownership, Borrowing, and Lifetimes.
These slide has be presented for a talk in BIC Lazio Casilina, that has been also the first meetup of Rust Rome!
Rust
Why do you care about Rust? Who has the time to learn all these new languages? It seems like a new one is popping up every other week and this trend is growing at an exponential rate. Good news, a fair number of them are crafted really well and efficiently solve specific problems. Bad news, how do you keep up with all of this, let alone decide which languages to include in your companies technology portfolio.
Despite the challenges of all these new languages, a majority of developers are intrigued about the idea of becoming a polyglot, but don't know where to begin or don't have the time. In my polyglot travels, there is one language of late that is the sure-fire answer to the above questions, Rust.
In this talk I’ll explore the value behind becoming more polyglotic as a developer, how to pick languages to learn, and then dive deep in the the language of Rust. Which in my opinion, is hands down the best up and coming languages to learn.
About the Presenter
Anthony Broad-Crawford has been a developer since the year 2000 with a short side stint as a semi-professional poker player. Since his transition to software development Anthony has...
1. Built 8 patent receiving technologies
2. Founded two global companies
3. Been a CTO (3x), CPO (1x), and CEO (1x)
and is currently the CTO at Fooda where he manages product, user experience, and engineering. Fooda is predominantly web and mobile technology company focused on bringing great & healthy food from the best restaurant's to people while at the office.
Through his career, in production applications Anthony has used Ruby, Java, Jave (Android), Objective-C and Swift, .NET, Erlang, Scala, Node.JS, LISP, Smalltalk, and even assembly, with his recent favorite, Rust . No, not all at the same time in the same application.
Anthony now spends his time building great teams, that leverage great technology, to build great products, but still looks to codes every chance he can get :)
This document discusses why Rust is a useful programming language. It provides an introduction to Rust, highlighting its memory safety features, ownership and borrowing system, and functional programming aspects like iterators and closures. Examples are given to demonstrate how Rust prevents common bugs like dangling pointers and iterator invalidation. The talk also covers Rust's type system, enums, patterns matching, and its Cargo package manager.
Brief overview of the Rust system programming language. Provides a concise introduction of its basic features, with an emphasis on its memory safety features (ownership, moves, borrowing) and programming style with generic functions, structures, and traits.
Rust Tutorial | Rust Programming Language Tutorial For Beginners | Rust Train...Edureka!
( ** Edureka Online Training: https://www.edureka.co/ ** )
This video on Rust Programming Language will help you understand basics of Rust programming. The following topics will be covered in this tutorial:
1. Why learn Rust?
2. What is Rust?
3. Install Rust
4. Rust Fundamentals
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
This document introduces Rust and provides an overview of its key concepts. It begins with an introduction to the presenter and agenda. It then covers basic terminology, common system programming errors, why Rust was created, how to install Rust, data types including primitive types, complex data structures, ownership and borrowing rules, lifetimes, and how to get involved in the Rust community. Key concepts discussed include Rust's type system, memory safety features, and package manager.
- InfoQ is a news and community site for software developers with 750,000 unique visitors per month publishing content in 4 languages.
- It posts content from QCon conferences including news, articles, presentations, interviews and books to empower software development through spreading knowledge and innovation.
- QCon conferences are practitioner-driven and designed for influencers of change and innovation, connecting them and catalyzing innovation, and have been attended by over 12,000 delegates since 2007 across 9 cities worldwide.
Rust is a systems programming language developed by Mozilla that provides memory safety without garbage collection. It uses concepts of ownership and borrowing to ensure memory safety issues like use-after-free do not occur. Rust offers zero-cost abstractions meaning abstraction mechanisms like generics have little to no performance overhead. It allows high levels of concurrency but requires memory references be valid during their entire lifetime.
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/28XnVtb.
Felix Klock describe the core concepts of the Rust language (ownership, borrowing, and lifetimes), as well as the tools beyond the compiler for open source software component distribution (cargo, crates.io). Filmed at qconlondon.com.
Felix Klock is a research engineer at Mozilla, where he works on the Rust compiler, runtime libraries, and language design. He previously worked on the ActionScript Virtual Machine for the Adobe Flash runtime. Klock is one of the developers of the Larceny Scheme language runtime.
This document provides an introduction to the Rust programming language. It describes that Rust was developed by Mozilla Research beginning in 2009 to combine the type safety of Haskell, concurrency of Erlang, and speed of C++. Rust reached version 1.0 in 2015 and is a generic, multiparadigm systems programming language that runs on platforms including ARM, Apple, Linux, Windows and embedded devices. It emphasizes security, performance and fine-grained memory safety without garbage collection.
Rust is a multi-paradigm systems programming language focused on safety, especially safe concurrency. Rust is syntactically similar to C++, but is designed to provide better memory safety while maintaining high performance.
This talk covers the following: principles of design, features, and applications. There are many successful projects used Rust, including browsers, operation systems, and database management systems, which will be also discussed in the talk.
A basic Introduction to Rust. Rust is a modern system programming language which offering different approach than other existing new modern system programming languages to deal with: memory safety without GC, abstraction without overhead, and concurrency without data races.
Rust and C++ are both systems programming languages but Rust provides better memory safety while maintaining performance. Rust uses a borrow checker to catch errors at compile time and disallows null references, while C++ relies more on programmer discipline. Rust also guarantees thread safety by preventing data races through its ownership and borrowing model.
Go is a statically typed, compiled programming language designed for building simple, reliable, and efficient software. Some key points:
- Go is natively compiled and uses static typing with type inference. It is targeted for system programming and server-side applications.
- It was created at Google in 2007 to address issues with other languages like dependency management, garbage collection, and support for concurrency.
- Popular users include Google, Docker, Dropbox, SoundCloud, and MongoDB. Domains it is used include distributed systems, cloud, web development, and systems programming.
- Key features include built-in concurrency and networking support, a rich standard library, and fast compilation. It aims to be
Rust has something unique to offer that languages in that space have never had before, and that is a degree of safety that languages like C and C++ have never had. Rust promises to deliver equivalent or better performance and greater productivity with guaranteed memory safety and data race freedom while allowing complete and direct control over memory.
This video will cover:
What is Rust?
Benefits of Rust
Rust Ecosystem
Popular Applications in Rust
Rust is a systems programming language that is fast, memory-efficient, and safe. It was created by Mozilla Research in 2010 and released in 2015. Rust uses a borrow checker to ensure memory safety at compile time without using garbage collection. It is suitable for writing system software, embedded applications, and web assembly. Rust aims to prevent common concurrency bugs and provides features like strong typing, pattern matching, and macros.
Go is a language developed by Google with multi-core in mind. Differ from other languages, concurrency is a first-class primitive in Go. This talk covers some useful patterns for dealing with concurrency.
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...joaomatosf_
- The document discusses Java object serialization vulnerabilities and remote code execution.
- It provides background on serialization/deserialization and how it can allow object injection and improper input validation.
- A key vulnerability discussed is CVE-2015-7501, which affected Apache Commons Collections and allowed remote code execution through a "gadget chain" triggered during deserialization.
This document discusses exploiting vulnerabilities related to HTTP host header tampering. It notes that tampering with the host header can lead to issues like password reset poisoning, cache poisoning, and cross-site scripting. It provides examples of how normal host header usage can be tampered with, including by spoofing the header to direct traffic to malicious sites. The document also lists some potential victims of host header attacks, like Drupal, Django and Joomla, and recommends developers check settings to restrict allowed hosts. It proposes methods for bruteforcing subdomains and host headers to find vulnerabilities.
Goroutines and channels are Go's approach to concurrency. Goroutines are lightweight threads that are scheduled by the Go runtime instead of the OS kernel. Channels allow goroutines to communicate by passing messages. This makes sharing state easier than with traditional threads. Common concurrency problems like deadlocks can still occur, so the Go race detector tool helps find issues. Overall, Go's model embraces concurrency through goroutines and channels, but care must still be taken to avoid problems.
Rust is the new kid on the block. It's a system programming language that is blazingly fast and offers powerful high-level abstractions better known from dynamic languages like Ruby or Python. Rust offers memory safety without a Garbage Collector and makes low-level programming easier and more secure. I will give an introductory talk about Rust and show some of its nicest features.
Rust is a systems programming language that provides memory safety without using a garbage collector. It achieves memory safety through rules of ownership, borrowing, and lifetimes that are checked at compile time. These rules prevent common memory bugs like memory leaks, dangling pointers, and use-after-free errors that are common in C and C++.
Is Rust Programming ready for embedded development?Knoldus Inc.
The traditional approach to embedded development would be to run an RTOS on a microcontroller and to write the application in C or C++. This gives huge benefits in terms of the resources required compared to a Linux-based system, but now developers are working down in the world of systems programming, where there is nothing between them and a critical memory-safety bug except a keen eye and perhaps some expensive, imperfect and/or tricky-to-use static analysis tools. That bug might just give hackers access to a product and to anything the product is connected to, both locally and remotely.
Of course, there are plenty of things other than memory safety bugs that might give hackers a route straight into a product, but it would be preferable for developers to concentrate on those, instead of worrying about memory leaks, buffer overflows or tracking down the root cause of a random, undefined behaviour.
But after Rust came into existence the programmers are getting memory safety with low-level control.
If you have considered using embedded rust, you may have run into questions such as “What is embedded?”, “What is a driver crate?” “Where does rtfm/rtic and cortex_m fit into the picture?” This webinar will give you answers to these questions and how you can start your embedded rust journey
Golang basics for Java developers - Part 1Robert Stern
This document provides an overview of Golang basics for Java developers. It covers Golang's history, features, syntax, data types, flow control, functions and interfaces, concurrency, and differences from Java. Key points include Golang being a compiled, statically typed language created at Google in 2007, its use of packages and imports, basic types like strings and integers, slices for dynamic arrays, maps for key-value pairs, functions with receivers, errors instead of exceptions, and goroutines for concurrency with channels.
React is a JavaScript framework used for building user interfaces. It uses components as the building blocks for user interfaces and embraces functional programming principles like immutable data and pure functions. The key aspects of React include JSX which allows writing HTML in JavaScript files, components which are functions that output HTML, and hooks which allow components to interact with state and lifecycle events.
A main selling point of Rust is that it guarantees, at compile time, that your application will be safe from dereferencing null or dangling pointers (a.k.a segmentation fault). Rust also makes it difficult to leak memory, but it is not a guarantee. In this talk we will be focusing on the language features, that helps Rust to ensure memory safety without needing for a garbage collector
A talk I gave at the Golang TO Meetup. Highlighting the beautiful powers of Go with respect to concurrency, and writing concurrent programs using it.
Code at: github.com/jsimnz/concurrency-talk
Rust provides safe, fast code through its ownership and borrowing model which prevents common bugs like use-after-free and data races. It enables building efficient parallel programs while avoiding the need for locking. Traits allow defining common interfaces that can be implemented for different types, providing abstraction without runtime costs. The language also supports unsafe code for interfacing with other systems while still enforcing safety within Rust programs through the type system.
Rust: Reach Further (from QCon Sao Paolo 2018)nikomatsakis
Rust is a new programming language that is growing rapidly. Rust's goal is to support a high-level coding style while offering performance comparable to C and C++ as well as minimal runtime requirements -- it does not require a runtime or garbage collector, and you can even choose to forego the standard library. At the same time, Rust offers strong support for parallel programming, including guaranteed freedom from data-races (something that GC’d languages like Java or Go do not provide).
Rust’s slim runtime requirements make it an ideal choice for integrating into other languages and projects. Anywhere that you could integrate a C or C++ library, you can choose to use Rust instead. Mozilla, for example, has rewritten a portion of the Firefox web browser in Rust -- while keeping the rest in C++. There are also projects for writing native extensions to Python, Ruby, and Node in Rust, as well as a recent effort to have the Rust compiler generate WebAssembly.
This talk will cover some of the highlights of Rust's design, and show how Rust's type system not only supports different parallel styles but also encourages users to write code that is amenable to parallelization. I'll also talk a bit about some of the experiences of using Rust in production, as well as how to integrate Rust into existing projects written in different languages.
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/28XnVtb.
Felix Klock describe the core concepts of the Rust language (ownership, borrowing, and lifetimes), as well as the tools beyond the compiler for open source software component distribution (cargo, crates.io). Filmed at qconlondon.com.
Felix Klock is a research engineer at Mozilla, where he works on the Rust compiler, runtime libraries, and language design. He previously worked on the ActionScript Virtual Machine for the Adobe Flash runtime. Klock is one of the developers of the Larceny Scheme language runtime.
This document provides an introduction to the Rust programming language. It describes that Rust was developed by Mozilla Research beginning in 2009 to combine the type safety of Haskell, concurrency of Erlang, and speed of C++. Rust reached version 1.0 in 2015 and is a generic, multiparadigm systems programming language that runs on platforms including ARM, Apple, Linux, Windows and embedded devices. It emphasizes security, performance and fine-grained memory safety without garbage collection.
Rust is a multi-paradigm systems programming language focused on safety, especially safe concurrency. Rust is syntactically similar to C++, but is designed to provide better memory safety while maintaining high performance.
This talk covers the following: principles of design, features, and applications. There are many successful projects used Rust, including browsers, operation systems, and database management systems, which will be also discussed in the talk.
A basic Introduction to Rust. Rust is a modern system programming language which offering different approach than other existing new modern system programming languages to deal with: memory safety without GC, abstraction without overhead, and concurrency without data races.
Rust and C++ are both systems programming languages but Rust provides better memory safety while maintaining performance. Rust uses a borrow checker to catch errors at compile time and disallows null references, while C++ relies more on programmer discipline. Rust also guarantees thread safety by preventing data races through its ownership and borrowing model.
Go is a statically typed, compiled programming language designed for building simple, reliable, and efficient software. Some key points:
- Go is natively compiled and uses static typing with type inference. It is targeted for system programming and server-side applications.
- It was created at Google in 2007 to address issues with other languages like dependency management, garbage collection, and support for concurrency.
- Popular users include Google, Docker, Dropbox, SoundCloud, and MongoDB. Domains it is used include distributed systems, cloud, web development, and systems programming.
- Key features include built-in concurrency and networking support, a rich standard library, and fast compilation. It aims to be
Rust has something unique to offer that languages in that space have never had before, and that is a degree of safety that languages like C and C++ have never had. Rust promises to deliver equivalent or better performance and greater productivity with guaranteed memory safety and data race freedom while allowing complete and direct control over memory.
This video will cover:
What is Rust?
Benefits of Rust
Rust Ecosystem
Popular Applications in Rust
Rust is a systems programming language that is fast, memory-efficient, and safe. It was created by Mozilla Research in 2010 and released in 2015. Rust uses a borrow checker to ensure memory safety at compile time without using garbage collection. It is suitable for writing system software, embedded applications, and web assembly. Rust aims to prevent common concurrency bugs and provides features like strong typing, pattern matching, and macros.
Go is a language developed by Google with multi-core in mind. Differ from other languages, concurrency is a first-class primitive in Go. This talk covers some useful patterns for dealing with concurrency.
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...joaomatosf_
- The document discusses Java object serialization vulnerabilities and remote code execution.
- It provides background on serialization/deserialization and how it can allow object injection and improper input validation.
- A key vulnerability discussed is CVE-2015-7501, which affected Apache Commons Collections and allowed remote code execution through a "gadget chain" triggered during deserialization.
This document discusses exploiting vulnerabilities related to HTTP host header tampering. It notes that tampering with the host header can lead to issues like password reset poisoning, cache poisoning, and cross-site scripting. It provides examples of how normal host header usage can be tampered with, including by spoofing the header to direct traffic to malicious sites. The document also lists some potential victims of host header attacks, like Drupal, Django and Joomla, and recommends developers check settings to restrict allowed hosts. It proposes methods for bruteforcing subdomains and host headers to find vulnerabilities.
Goroutines and channels are Go's approach to concurrency. Goroutines are lightweight threads that are scheduled by the Go runtime instead of the OS kernel. Channels allow goroutines to communicate by passing messages. This makes sharing state easier than with traditional threads. Common concurrency problems like deadlocks can still occur, so the Go race detector tool helps find issues. Overall, Go's model embraces concurrency through goroutines and channels, but care must still be taken to avoid problems.
Rust is the new kid on the block. It's a system programming language that is blazingly fast and offers powerful high-level abstractions better known from dynamic languages like Ruby or Python. Rust offers memory safety without a Garbage Collector and makes low-level programming easier and more secure. I will give an introductory talk about Rust and show some of its nicest features.
Rust is a systems programming language that provides memory safety without using a garbage collector. It achieves memory safety through rules of ownership, borrowing, and lifetimes that are checked at compile time. These rules prevent common memory bugs like memory leaks, dangling pointers, and use-after-free errors that are common in C and C++.
Is Rust Programming ready for embedded development?Knoldus Inc.
The traditional approach to embedded development would be to run an RTOS on a microcontroller and to write the application in C or C++. This gives huge benefits in terms of the resources required compared to a Linux-based system, but now developers are working down in the world of systems programming, where there is nothing between them and a critical memory-safety bug except a keen eye and perhaps some expensive, imperfect and/or tricky-to-use static analysis tools. That bug might just give hackers access to a product and to anything the product is connected to, both locally and remotely.
Of course, there are plenty of things other than memory safety bugs that might give hackers a route straight into a product, but it would be preferable for developers to concentrate on those, instead of worrying about memory leaks, buffer overflows or tracking down the root cause of a random, undefined behaviour.
But after Rust came into existence the programmers are getting memory safety with low-level control.
If you have considered using embedded rust, you may have run into questions such as “What is embedded?”, “What is a driver crate?” “Where does rtfm/rtic and cortex_m fit into the picture?” This webinar will give you answers to these questions and how you can start your embedded rust journey
Golang basics for Java developers - Part 1Robert Stern
This document provides an overview of Golang basics for Java developers. It covers Golang's history, features, syntax, data types, flow control, functions and interfaces, concurrency, and differences from Java. Key points include Golang being a compiled, statically typed language created at Google in 2007, its use of packages and imports, basic types like strings and integers, slices for dynamic arrays, maps for key-value pairs, functions with receivers, errors instead of exceptions, and goroutines for concurrency with channels.
React is a JavaScript framework used for building user interfaces. It uses components as the building blocks for user interfaces and embraces functional programming principles like immutable data and pure functions. The key aspects of React include JSX which allows writing HTML in JavaScript files, components which are functions that output HTML, and hooks which allow components to interact with state and lifecycle events.
A main selling point of Rust is that it guarantees, at compile time, that your application will be safe from dereferencing null or dangling pointers (a.k.a segmentation fault). Rust also makes it difficult to leak memory, but it is not a guarantee. In this talk we will be focusing on the language features, that helps Rust to ensure memory safety without needing for a garbage collector
A talk I gave at the Golang TO Meetup. Highlighting the beautiful powers of Go with respect to concurrency, and writing concurrent programs using it.
Code at: github.com/jsimnz/concurrency-talk
Rust provides safe, fast code through its ownership and borrowing model which prevents common bugs like use-after-free and data races. It enables building efficient parallel programs while avoiding the need for locking. Traits allow defining common interfaces that can be implemented for different types, providing abstraction without runtime costs. The language also supports unsafe code for interfacing with other systems while still enforcing safety within Rust programs through the type system.
Rust: Reach Further (from QCon Sao Paolo 2018)nikomatsakis
Rust is a new programming language that is growing rapidly. Rust's goal is to support a high-level coding style while offering performance comparable to C and C++ as well as minimal runtime requirements -- it does not require a runtime or garbage collector, and you can even choose to forego the standard library. At the same time, Rust offers strong support for parallel programming, including guaranteed freedom from data-races (something that GC’d languages like Java or Go do not provide).
Rust’s slim runtime requirements make it an ideal choice for integrating into other languages and projects. Anywhere that you could integrate a C or C++ library, you can choose to use Rust instead. Mozilla, for example, has rewritten a portion of the Firefox web browser in Rust -- while keeping the rest in C++. There are also projects for writing native extensions to Python, Ruby, and Node in Rust, as well as a recent effort to have the Rust compiler generate WebAssembly.
This talk will cover some of the highlights of Rust's design, and show how Rust's type system not only supports different parallel styles but also encourages users to write code that is amenable to parallelization. I'll also talk a bit about some of the experiences of using Rust in production, as well as how to integrate Rust into existing projects written in different languages.
Rust tutorial from Boston Meetup 2015-07-22nikomatsakis
The document discusses various topics related to learning and using the Rust programming language. It begins with an introduction to some of Rust's core concepts like ownership and borrowing which provide memory safety without garbage collection. It then covers everyday usage of Rust including common data types, modules, cargo, and derives. The document also demonstrates concepts like methods, enums, slices, iterators, and privacy. It concludes by recommending additional resources for learning more about Rust.
Slides from Advaned Python lectures I gave recently in Haifa Linux club
Advanced python, Part 2:
- Slots vs Dictionaries
- Basic and Advanced Generators
- Async programming
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...apidays
Apidays Paris 2023 - Software and APIs for Smart, Sustainable and Sovereign Societies
December 6, 7 & 8, 2023
Forget TypeScript, Choose Rust to build Robust, Fast and Cheap APIs
Zacaria Chtatar, Backend Software Engineer at HaveSomeCode
------
Check out our conferences at https://www.apidays.global/
Do you want to sponsor or talk at one of our conferences?
https://apidays.typeform.com/to/ILJeAaV8
Learn more on APIscene, the global media made by the community for the community:
https://www.apiscene.io
Explore the API ecosystem with the API Landscape:
https://apilandscape.apiscene.io/
The JVM JIT compiler and deoptimizer are triggered under certain conditions like method invocation counts, changes in program behavior, and hot spots. The JIT initially compiles code to generate fast machine instructions while the deoptimizer reverts back to interpreted execution if needed.
Rust provides memory safety without garbage collection through its ownership and borrowing model that is checked at compile time. Ownership rules ensure that references to resources like vectors remain valid by moving the vector when it is passed to a function. Borrowing allows immutable or mutable references to a resource, but not both at the same time, avoiding data races. Rust achieves performance comparable to C++ through its zero-cost abstractions and moves semantics that avoid unnecessary data copying.
Rust: код может быть одновременно безопасным и быстрым, Степан КольцовYandex
Последние 15 лет между разработчиками на Java и на C++ ведётся спор о том, какой язык программирования хуже — Java или C++. Программы на C++ глючат, падают, и в них утекает память. Программы на Java тормозят и требуют слишком много памяти.
Rust — новый язык программирования, разрабатываемый компанией Mozilla — решает проблемы Java и C++: программы, написанные на Rust, одновременно быстрые и безопасные. Rust является таким же низкоуровневым, close-to-metal языком программирования, как и C++, однако в язык встроены конструкции, позволяющие на этапе компиляции доказывать, что в программе не случится обращения к неинициализированной памяти (механизм borrowed pointers). Большая часть моего рассказа будет посвящена описанию этого механизма.
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
HotSpot promises to do the "right" thing for us by identifying our hot code and compiling "just-in-time", but how does HotSpot make those decisions?
This presentation aims to detail how HotSpot makes those decisions and how it corrects its mistakes through a series of demos that you run yourself.
Go uses goroutines and channels for concurrency. Goroutines are lightweight threads that communicate through channels, which are typed queues that allow synchronous message passing. Channels can be used to synchronize access to shared memory, allowing both shared memory and message passing for concurrency. The language is designed for scalable fine-grained concurrency but further improvements are still needed, especially to the goroutine scheduler.
1. The code sample provided defines a simple Java class called HelloWorld with a main method that prints "Epic Fail".
2. The class contains a single public static void main method that takes an array of String arguments.
3. Within the main method it prints the text "Epic Fail" without any other processing or output.
Rust — это современный, практический, быстрый и безопасный язык программирования. Некоторые говорят, что Rust — это как C++, если бы его писал человек, знающий Haskell.
Система типов Rust решает главную проблему C++ — небезопасность. C++ очень легко сделать ошибки, которые приведут к поломкам (например, use after free). Rust позволяет писать безопасный код, сохраняя при этом выразительность и околонулевые накладные расходы C++. В докладе будут подробно описаны механизмы языка, которые контролируют безопасность программы.
Хотя в данный момент Rust ещё не подходит для использования в продакшне, его всё равно стоит изучать. Во-первых, потому что это очень интересный подход к программированию, а во-вторых, потому что через несколько лет для разработки требовательных к ресурсам программ будет необходим именно Rust или другой похожий инструмент.
The document outlines the plan for the day which includes administrative tasks, communication methods, grading, and recording classes. It discusses IRC, a class website, and email for communication. It notes grading will not be stressful and includes a grading form. It describes future problem sets will include an auto-grader and demos. Recording classes will be somewhat edited and to press a button if you don't want to be recorded. It ends with asking if there are any questions.
Peter Lawrey is the CEO of Chronicle Software. He has 7 years experience working as a Java developer for investment banks and trading firms. Chronicle Software helps companies migrate to high performance Java code and was involved in one of the first large Java 8 projects in production in December 2014. The company offers workshops, training, consulting and custom development services. The talk will cover reading and writing lambdas, capturing vs non-capturing lambdas, transforming imperative code to streams, mixing imperative and functional code, and taking Q&A.
The document discusses different implementations of shared pointers in C++ and proposes an adaptive approach. It summarizes three common implementations of shared pointers: invasive, slim, and fat. It then proposes a "linked small pointer" implementation that is optimized for small object counts by using a linked list instead of a reference count. For larger object counts, it would transition to a traditional reference counted implementation. Finally, it proposes an "adaptive linked pointer" that uses unused bits in pointers to track reference counts for smaller objects and dynamically transitions between the linked and reference counted approaches. Benchmark results show this adaptive approach has performance comparable to traditional implementations.
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...corehard_by
What do threads, atomic variables, mutexes, and conditional variables have in common? They are the basic building blocks of any concurrent application in C++, which are even for the experienced C++ programmers a big challenge. This massively changed with C++17 and change even more with C++20/23. What did we get with C++17, what can we hope for with C++20/23? With C++17, most of the standard template library algorithms are available in sequential, parallel, and vectorised variants. With the upcoming standards, we can look forward to executors, transactional memory, significantly improved futures and coroutines. To make it short. These are just the highlights from the concurrent and parallel perspective. Thus there is the hope that in the future C++ abstractions such as executors, transactional memory, futures and coroutines are used and that threads, atomic variables, mutexes and condition variables are just implementation details.
How is Rust able to enforce safety in your code?
The simple answer to this question is: the borrow checker.
This presentation is an overview on the language concepts that helps the developer to allocate and deallocate memory in an efficient way just like in C/C++, and also safe.
Rust learnt from C/C++ design patterns and included those in the language, adding the concept of Ownership and Borrowing.
Camisole is a secure online sandbox for grading student code submissions. It uses Linux namespaces and cgroups to isolate untrusted code and enforce resource limits like memory and time. Camisole has a simple HTTP API and supports many programming languages through a modular language definition system. It aims to securely evaluate code submissions for online courses and programming contests in a lightweight and language-agnostic way.
Similar to Introduction to Rust language programming (20)
C# has evolved significantly over time, from version 1 through the latest version 8. Some key developments include the addition of generics, LINQ, asynchronous programming, and dynamic features. C# continues to focus on productivity and safe, efficient code with recent versions adding capabilities like nullable reference types, async streams, and ranges/indices. .NET has also evolved with improvements to performance and new functionality in versions like .NET Core 2.1. Looking ahead, .NET Core 3 will add support for desktop frameworks like WinForms and WPF.
Go es un lenguaje de programación diseñado para desarrollar de software de “backend” altamente escalable, de manera sencilla y rápida. En esta presentacion veremos que es Go, como se programa sobre él, y como utilizarlo en Azure.
Azure Functions allow developers to write small pieces of code, or "functions", that are triggered by events like HTTP requests or messages in Azure services like Storage Queues or Event Hubs. Functions can be used to integrate apps and services, build backends for mobile and web apps, and perform offline data processing. Functions support triggers from various Azure services and other sources, and can be written in C#, F#, Node.js, Python or Java. Functions provide a serverless compute experience and scale automatically based on demand.
Despliegue y Monitoreo de aplicaciones ASP.NET Core en LinuxRodolfo Finochietti
Este documento presenta cómo desplegar y monitorear aplicaciones ASP.NET Core en Linux. Explica cómo implementar aplicaciones ASP.NET Core en Linux y cómo supervisar el rendimiento y estado de las aplicaciones una vez implementadas.
Por primera vez ASP.NET funciona en Windows, Max, y Linux mediante la version de multiplataforma de ASP.NET, llamada ASP.NET Core. Esta versión incluye muchos nuevas características, como el soporte side by side, tiempos de desarrollo mas cortos, soporte para entornos de containers y cloud, que presentaremos en estos slides.
Este documento describe la evolución de Internet hacia la Internet de las Cosas y proporciona una introducción a Azure IoT Hub. Resume que Azure IoT Hub permite la comunicación bidireccional confiable entre millones de dispositivos IoT y un back-end a escala, y proporciona seguridad, monitoreo y SDK para conectar y controlar dispositivos de forma remota. El documento también contrasta IoT Hub con Event Hubs y proporciona un ejemplo de cómo se puede usar IoT Hub para controlar un robot LEGO EV3 de forma remota.
Este documento resume la evolución de Internet y las arquitecturas de microservicios. Explica que Node.js es una plataforma para construir software de red altamente escalable usando JavaScript en el servidor. Node.js se basa en eventos en lugar de hilos, lo que le permite manejar muchas conexiones concurrentes de forma eficiente.
Este documento describe cómo la Internet de las Cosas (IoT) puede utilizarse para realizar el seguimiento de camiones en una planta a través de dispositivos Bluetooth colocados en los camiones y en la planta, y para proporcionar asistencia contextual a los operadores de mantenimiento de plantas sobre las tareas requeridas para cada máquina.
Este documento habla sobre .NET y su evolución a través de las diferentes versiones. Explica que .NET Framework está optimizado para Windows mientras que .NET Core es multiplataforma y modular. También cubre temas como la migración del desarrollo de escritorio a web, las bibliotecas y componentes de .NET, y las herramientas y editores compatibles con .NET en diferentes sistemas operativos como Windows, Mac y Linux.
Este documento presenta la plataforma Universal Windows de Microsoft, la cual permite desarrollar aplicaciones para todos los dispositivos Windows de una sola vez. La plataforma incluye un núcleo común, una API universal y herramientas de desarrollo como Visual Studio para crear aplicaciones adaptables que funcionen en escritorio, móvil, Xbox y más. El compilador .NET Native mejora el rendimiento al producir código nativo sin necesidad de un runtime.
Este documento discute las tecnologías disponibles para desarrollar aplicaciones en tiempo real como SignalR. SignalR extiende HTTP para proporcionar sockets a través de los cuales los clientes pueden recibir actualizaciones de los servidores en tiempo real. Ofrece varios mecanismos como long polling, forever frames y web sockets. SignalR también proporciona abstracciones como PersistentConnection y Hub que simplifican el desarrollo de aplicaciones interactivas en tiempo real.
La "Web Moderna" se refiere a la evolución de la web hacia frameworks, diseños responsivos, cloud y herramientas basadas en estándares. Algunas características clave incluyen el diseño centrado en dispositivos móviles y tabletas, frameworks de cliente ligeros y listos para la nube, y la adopción de herramientas populares de terceros. ASP.NET es un estándar que define una abstracción entre el servidor web y el framework web, permitiendo el desarrollo y la integración más rápidos de nuevos componentes
This document discusses the .NET Compiler Platform ("Roslyn") and new features in C# 6. It provides an overview of Roslyn's syntax tree API and workspace API. It also shows examples of new C# 6 features like auto-properties, string interpolation and exception filtering.
The document discusses .NET and its future direction. It covers topics like the next generation JIT compiler, SIMD, runtime compilers, Roslyn, language innovations, Entity Framework, universal projects, .NET Native, cross-device capabilities, and partnerships like Xamarin. It also discusses openness, the .NET runtime being optimized for the cloud, and modular frameworks that can be deployed inside applications.
This document summarizes new features in Visual Studio 2013 and ASP.NET 5.1. Visual Studio 2013 includes improvements to the IDE like synchronized settings and enhanced debugging tools. .NET 4.5.1 focuses on application performance. ASP.NET is now unified across frameworks. New features were demonstrated for ASP.NET Identity, Entity Framework 6, MVC scaffolding using Bootstrap, Web API 2 including attribute routing and OData, SignalR, and Azure tooling in Visual Studio.
El documento describe las herramientas Visual Studio 2013 para el desarrollo de bases de datos, incluyendo SQL Server Data Tools, que permite el desarrollo de bases de datos de forma conectada y desconectada. Las herramientas proveen funcionalidades como depuración, comparación de esquemas, publicación de cambios y soporte para diferentes versiones de SQL Server y Azure SQL. Adicionalmente, se presenta una demostración de las capacidades de los Proyectos de Base de Datos en Visual Studio.
Este documento cubre el uso de ALM con Visual Studio y TFS 2013. Incluye información sobre el ciclo de desarrollo con énfasis en la productividad del desarrollador, el rendimiento de las aplicaciones y la innovación continua utilizando herramientas como TFS, Git, Visual Studio 2013 y .NET 4.5.1.
Que hay de nuevo en 2013 en la plataforma Microsoft para desarrolladoresRodolfo Finochietti
This document summarizes new features in the Microsoft platform for programmers in 2013, including improvements to Visual Studio 2013 like enhanced debugging and diagnostics tools, .NET 4.5.1 updates like automatic binding redirection and ASP.NET idle connection resiliency, and ASP.NET features like ASP.NET Identity and attribute routing in WebAPI. It focuses on enhancing developer productivity, application performance, continuous innovation and open source. Contact information is provided at the end.
Este documento introduce ASP.NET Web API, describiendo su arquitectura basada en HTTP y REST. Explica las características clave de Web API como su derivación de ASP.NET MVC, soporte para formatos de medios, negociación de contenido, validación y consultas OData. También cubre temas como la descripción de API, llamadas asíncronas y demostrando su funcionamiento.
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Speck&Tech
ABSTRACT: A prima vista, un mattoncino Lego e la backdoor XZ potrebbero avere in comune il fatto di essere entrambi blocchi di costruzione, o dipendenze di progetti creativi e software. La realtà è che un mattoncino Lego e il caso della backdoor XZ hanno molto di più di tutto ciò in comune.
Partecipate alla presentazione per immergervi in una storia di interoperabilità, standard e formati aperti, per poi discutere del ruolo importante che i contributori hanno in una comunità open source sostenibile.
BIO: Sostenitrice del software libero e dei formati standard e aperti. È stata un membro attivo dei progetti Fedora e openSUSE e ha co-fondato l'Associazione LibreItalia dove è stata coinvolta in diversi eventi, migrazioni e formazione relativi a LibreOffice. In precedenza ha lavorato a migrazioni e corsi di formazione su LibreOffice per diverse amministrazioni pubbliche e privati. Da gennaio 2020 lavora in SUSE come Software Release Engineer per Uyuni e SUSE Manager e quando non segue la sua passione per i computer e per Geeko coltiva la sua curiosità per l'astronomia (da cui deriva il suo nickname deneb_alpha).
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc
How does your privacy program stack up against your peers? What challenges are privacy teams tackling and prioritizing in 2024?
In the fifth annual Global Privacy Benchmarks Survey, we asked over 1,800 global privacy professionals and business executives to share their perspectives on the current state of privacy inside and outside of their organizations. This year’s report focused on emerging areas of importance for privacy and compliance professionals, including considerations and implications of Artificial Intelligence (AI) technologies, building brand trust, and different approaches for achieving higher privacy competence scores.
See how organizational priorities and strategic approaches to data security and privacy are evolving around the globe.
This webinar will review:
- The top 10 privacy insights from the fifth annual Global Privacy Benchmarks Survey
- The top challenges for privacy leaders, practitioners, and organizations in 2024
- Key themes to consider in developing and maintaining your privacy program
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
“An Outlook of the Ongoing and Future Relationship between Blockchain Technologies and Process-aware Information Systems.” Invited talk at the joint workshop on Blockchain for Information Systems (BC4IS) and Blockchain for Trusted Data Sharing (B4TDS), co-located with with the 36th International Conference on Advanced Information Systems Engineering (CAiSE), 3 June 2024, Limassol, Cyprus.
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!SOFTTECHHUB
As the digital landscape continually evolves, operating systems play a critical role in shaping user experiences and productivity. The launch of Nitrux Linux 3.5.0 marks a significant milestone, offering a robust alternative to traditional systems such as Windows 11. This article delves into the essence of Nitrux Linux 3.5.0, exploring its unique features, advantages, and how it stands as a compelling choice for both casual users and tech enthusiasts.
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Maruthi Prithivirajan, Head of ASEAN & IN Solution Architecture, Neo4j
Get an inside look at the latest Neo4j innovations that enable relationship-driven intelligence at scale. Learn more about the newest cloud integrations and product enhancements that make Neo4j an essential choice for developers building apps with interconnected data and generative AI.
How to Get CNIC Information System with Paksim Ga.pptxdanishmna97
Pakdata Cf is a groundbreaking system designed to streamline and facilitate access to CNIC information. This innovative platform leverages advanced technology to provide users with efficient and secure access to their CNIC details.
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfMalak Abu Hammad
Discover how MongoDB Atlas and vector search technology can revolutionize your application's search capabilities. This comprehensive presentation covers:
* What is Vector Search?
* Importance and benefits of vector search
* Practical use cases across various industries
* Step-by-step implementation guide
* Live demos with code snippets
* Enhancing LLM capabilities with vector search
* Best practices and optimization strategies
Perfect for developers, AI enthusiasts, and tech leaders. Learn how to leverage MongoDB Atlas to deliver highly relevant, context-aware search results, transforming your data retrieval process. Stay ahead in tech innovation and maximize the potential of your applications.
#MongoDB #VectorSearch #AI #SemanticSearch #TechInnovation #DataScience #LLM #MachineLearning #SearchTechnology
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
20 Comprehensive Checklist of Designing and Developing a WebsitePixlogix Infotech
Dive into the world of Website Designing and Developing with Pixlogix! Looking to create a stunning online presence? Look no further! Our comprehensive checklist covers everything you need to know to craft a website that stands out. From user-friendly design to seamless functionality, we've got you covered. Don't miss out on this invaluable resource! Check out our checklist now at Pixlogix and start your journey towards a captivating online presence today.
5. More than that …
C/C++
more control,
less safety
Haskell/Python/C#/Java
less control,
more safety
more control,
more safety
Rust
6. Why Rust
• Open Source and Open Governance
• Top-tier performance
• Like C/C++ or better
• Memory safe
• No memory leak
• No runtime, no GC
• Runs everywhere
• No undefined behavior
• Zero-cost abstractions
• Ergonomic syntax
• Expressive data structures
• Targets the same use cases as C/C++
• All of them
• Sponsored by Mozilla
• Makers of Firefox
7. Embrace the challengelagash.com
Abrief history
Pre-2009
Graydone Hoare
terrible memory leakages/bugs in Firefox
2009
Mozilla
Corp.
2013
Samsung Corp.
Joined
2015/05/15
v1.0 Stable Released!
8. Embrace the challengelagash.com
Soft
• Web browser
• Firefox
• Servo: Mozilla's parallel web browser engine developed in collaboration with Samsung
• Quantum:a project, composed of several sub-projects, to improve the Gecko web browser engine of Firefox, developed by
Mozilla
• Operating system
• Magic Pocket: Dropbox's file system that powers their Diskotech petabyte storage machines
• Redox: a microkernel operating system
• Stratis: a file system planned for Fedora 28
• Railcae: a container runtime by Oracle
• Firecracker: secure and fast microVMs for serverless computing[58]
• Other
• exa: a "modern replacement for ls“
• Microsoft Azure IoT Edge: a platform used to run Azure services and artificial intelligence on IoT devices has components
implemented in Rust
• OpenDNS:used in two of its components[60][61][62]
• Tor: an anonymity network, written in C originally, is experimenting with porting to Rust for its security features.
• Wargroove: a video game developed by Chucklefish that uses Rust for its server software
• Xi: a text editor from Raph Levien,[66] used within the Fuchsia operating system.[67]
13. Embrace the challengelagash.com
What is safety?
typedef struct Dummy { int a; int b; } Dummy;
void foo(void) {
Dummy *ptr = (Dummy *) malloc(sizeof(struct Dummy));
Dummy *alias = ptr;
free(ptr);
int a = alias.a;
free(alias);
}
ptr
alias
.a
.b
Stack
Heap
Dangling Pointer
Use after free
Double free
Aliasing Mutation
14. Embrace the challengelagash.com
Rust’s Solution: Ownership & Borrowing
Compiler enforces:
Every resource has a unique owner.
Others can borrow the resource from its owner.
Owner cannot free or mutate its resource while it is borrowed.
Aliasing Mutation
No need for runtime Memory safety Data-race freedom
15. Embrace the challengelagash.com
Ownership
struct Dummy { a: i32, b: i32 }
fn foo() {
let mut res = Box::new(Dummy {
a: 0,
b: 0
});
}
res
.a = 0
.b = 0
Stack
Heap
owns
res is out of scope and its resource is freed automatically
16. Embrace the challengelagash.com
Lifetime is determined and checked statically.
struct Dummy { a: i32, b: i32 }
fn foo() {
let mut res: Box<Dummy>;
{
res = Box::new(Dummy {a: 0, b: 0});
}
res.a = 2048;
}
Lifetime that res
owns the resource.
Compiling Error: res no longer owns the resource
Ownership: Lifetime
17. Embrace the challengelagash.com
Ownership: Unique Owner
struct Dummy { a: i32, b: i32 }
fn foo() {
let mut res = Box::new(Dummy {
a: 0,
b: 0
});
take(res);
println!(“res.a = {}”, res.a);
}
fn take(arg: Box<Dummy>) {
}
Ownership is moved from res to arg
arg is out of scope and the resource is freed automatically
Compiling Error!
Aliasing Mutation
18. Embrace the challengelagash.com
Immutable/Shared Borrowing (&)
struct Dummy { a: i32, b: i32 }
fn foo() {
let mut res = Box::new(Dummy{
a: 0,
b: 0
});
take(&res);
res.a = 2048;
}
fn take(arg: &Box<Dummy>) {
arg.a = 2048;
}
Resource is immutably borrowed by arg from res
Resource is still owned by res. No free here.
Resource is returned from arg to res
Aliasing Mutation
Compiling Error: Cannot mutate via
an immutable reference
19. Embrace the challengelagash.com
struct Dummy { a: i32, b: i32 }
fn foo() {
let mut res = Box::new(Dummy{a: 0, b: 0});
take(&mut res);
res.a = 4096;
let borrower = &mut res;
let alias = &mut res;
}
fn take(arg: &mut Box<Dummy>) {
arg.a = 2048;
}
Mutable Borrowing (&mut)
Aliasing Mutation
Mutably borrowed by arg from res
Returned from arg to res
Multiple mutable borrowings
are disallowed
20. Embrace the challengelagash.com
Every resource in Rust is immutable by default.
mut is used to declare a resource as mutable.
struct Dummy { a: i32, b: i32 }
fn foo() {
let res = Box::new(Dummy{a: 0, b: 0});
res.a = 2048;
let borrower = &mut res;
}
Error: Resource is immutable
Error: Cannot get a mutable borrowing
of an immutable resource
Mutability
21. Embrace the challengelagash.com
struct Dummy { a: i32, b: i32 }
fn foo() {
let mut res = Box::new(Dummy {a: 0, b: 0});
std::thread::spawn(move || {
let borrower = &mut res;
borrower.a += 1;
});
res.a += 1;
}
Concurrency & Data-race Freedom
Error: res is being mutably borrowed
res is mutably borrowed
Spawn a new thread
23. Embrace the challengelagash.com
Mutably sharing is inevitable in the real world.
Example: mutable doubly linked list
prev
next
prev
next
prev
next
struct Node {
prev: option<Box<Node>>,
next: option<Box<Node>>
}
Mutably Sharing
24. Embrace the challengelagash.com
Compiler does NOT check the memory safety of most operations wrt. raw pointers.
Most operations wrt. raw pointers should be encapsulatedin a unsafe {} syntactic structure.
prev
next
prev
next
prev
next
struct Node {
prev: option<Box<Node>>,
next: *mut Node
}
Raw pointer
Rust’s Solution: Raw Pointers
25. Embrace the challengelagash.com
let a = 3;
unsafe {
let b = &a as *const u32 as *mut u32;
*b = 4;
}
println!(“a = {}”, a);
Rust’s Solution: Raw Pointers
I know what I’m doing
Print “a = 4”
26. Embrace the challengelagash.com
All foreign functions are unsafe.
extern {
fn write(fd: i32, data: *const u8, len: u32) -> i32;
}
fn main() {
let msg = b”Hello, world!n”;
unsafe {
write(1, &msg[0], msg.len());
}
}
Foreign Function Interface (FFI)
33. Embrace the challengelagash.com
Pattern Match
let x = 5;
match x {
1 => println!(“one”),
2 => println!(“two”),
3|4 => println!(“three or four”),
5 ... 10 => println!(“five to ten”),
e @ 11 ... 20 => println!(“{}”, e);
_ => println!(“others”),
}
Compiler enforces the matching is complete
34. Embrace the challengelagash.com
Pattern Match
let x = Dummy{ a: 2048, b: 4096 };
match x {
Dummy{ a: va, b: vb } => va + vb,
}
match x {
Dummy{ a: va, .. } => println!(“a={}”, va),
}
48. Argentina | Buenos Aires
+54 (11) 4982 4185
info@lagash.com
Chile | Santiago de Chile
+56 (2) 2231 9428
info_chile@lagash.com
Colombia | Bogotá
+57 (1) 750 5276
info_colombia@lagash.com
México | México DF
+52 (55) 6394 0617
info_mexico@lagash.com
USA | Seattle - US
+1 844 4 Lagash
infousa@lagash.com
Uruguay | Montevideo
+598 2623 2546
info_uy@lagash.com
Let’s keep in touch
Editor's Notes
This is actually generally used with C++.
It means paying no penalty for the abstraction, or said otherwise, it means that whether you use the abstraction or instead go for the "manual" implementation you end up having the same costs (same speed, same memory consumption, ...).