舉報(bào)

會(huì)員
Learning Rust
最新章節(jié):
Summary
ThebookisforabsolutebeginnerstoRust,whowanttobuildhighperformance,concurrentapplicationsfortheirprojects.ItissuitablefordeveloperswhohaveabasicknowledgeofprogramminganddeveloperswhoareusingtheC#/C++languagetowritetheirapplications.NoknowledgeofRustisexpected.
最新章節(jié)
- Summary
- C structs
- Dealing with the unknown
- Calling Rust from another language
- Targeting a Rust object
- Targeting synchronous callbacks
品牌:中圖公司
上架時(shí)間:2021-07-02 18:51:09
出版社:Packt Publishing
本書數(shù)字版權(quán)由中圖公司提供,并由其授權(quán)上海閱文信息技術(shù)有限公司制作發(fā)行
- Summary 更新時(shí)間:2021-07-02 23:08:10
- C structs
- Dealing with the unknown
- Calling Rust from another language
- Targeting a Rust object
- Targeting synchronous callbacks
- Monitoring an external process within an FFI
- Drop it!
- Cleaning up after yourself
- Accessing global variables
- A practical example
- Wrappers
- Can we make things safer?
- What happens if the types don't match?
- Let's extend things a bit
- What's the big deal? That was simple enough!
- What's the [link(name="")] for?
- Creating the code
- Including the dependency
- The three-step program
- Introducing our simple library
- Foreign Function Interfaces
- Summary
- std::vec
- std::usize
- std::u64
- std::u32
- std::u16
- std::u8
- std::time
- std::thread
- std::sync
- std::string
- std::str
- std::slice
- std::ptr
- std::process
- std::path
- std::panic
- std::os
- std::num
- std:net
- std::mem
- std::marker
- std::iter
- std::isize
- std::io
- std::i64
- std::i32
- std::i16
- std::i8
- std::hash
- std::fs
- std::fmt
- std:ffi
- std::f64
- std::f32
- std:error
- std:env
- std::default
- std::convert
- std::collections
- std::cmp
- std::clone
- std::char
- std::cell
- std::boxed
- std::borrow
- std::ascii
- std::Any
- The standard modules
- Prelude
- Macros (overview)
- Primitive types (overview)
- The standard modules (overview)
- What is the standard library?
- Chapter format
- The Standard Library
- Summary
- Task 4 – extending the crate (part 2)
- The task
- Task 3 – extending the crate (part 1)
- The task
- Task 2 – cleaning the code (part 2)
- The task
- The struct option
- The String option
- The problems with each option
- Task 1 – cleaning the code (part 1)
- Now It's Your Turn!
- Summary
- Thread panics
- Thread synchronization
- Why do we put the thread to sleep?
- Problem solved – use Mutex
- The reference counter
- Ownership has its advantages
- Back to threading
- What is the move parameter?
- Returning a closure
- Closures with explicit lifetimes – a special case
- Closures as function arguments
- Closures aren't all they first appear to be
- Closures
- Joining threads
- An easy approach to thinking about how threads work.
- A beginner's guide to threading in Rust
- Back to sync
- Interior mutability
- And it's obviously mutable it has mut in the definition
- When is an immutable variable not an immutable variable?
- Sync
- Send
- What was that all about?
- A bit of a story
- Concurrency in Rust
- Summary
- The use-glob-self approach
- The use-glob approach
- The use-me-but-call-me-something-else approach
- The use-me approach
- The you-decide approach
- The use-everything approach
- Optimizing your use statements
- Altering the crate name
- Changing the scope
- External dependencies
- Let's give our crate a quick run out
- Making something public
- Adding unit tests to the library
- Beware of double name scopes
- Let's add some code
- The mod.rs file
- What about submodules?
- The multifile module
- Creating top-level modules
- Let's create!
- Using a useful name
- Back to our math library
- I can see a problem with this analogy
- Looking at modules
- What exactly is a crate?
- Creating Your Own Crate
- Summary
- Keeping your object safe
- Let's see dynamic dispatch
- Let's create a sample test setup
- Trait objects
- Deriving
- Inheritance
- Rounding off traits
- Can the default method be overridden?
- Can we reduce the amount of code further?
- Trait bounds
- Try to compile
- Back to the where version
- So what does happen?
- Generics - a small aside
- Something you may have noticed
- Making it work
- Using where
- Defining the impl for specific types
- Traits and generics
- A simple crate example
- And back to traits we go...
- The impl lifetime
- Impl
- Traits and Impl
- The whole #!
- The unsafe directive
- A generic problem
- Understanding the error
- Generics 101
- Introducing Generics Impl and Traits
- Summary
- Input and output
- Output only
- Input only
- Input and output lifetimes
- 'struct
- Always consider the scope
- Multiple lifetimes
- Lifetime within an struct
- Lifetime of other types
- The lifetime variable - '
- The mythical bank account
- The lifetime
- It's all for your own good
- Think about the scope
- Fixing the problem
- The Rust borrowing rules
- Mutable borrows
- Borrow immutability
- Borrowing in Rust
- The Copy trait
- Why is this important?
- Stack and heap variables
- Variable binding
- Ownership – from the beginning
- Abstractions
- Ownership in Rust
- Lifetime
- Borrowing
- Ownership
- What are they?
- The Rust Application Lifetime
- Summary
- And back to if let
- Using match with a compound type
- Let's add an if into the mix
- Creating a binding within a match pattern
- Ranges
- Fall through patterns
- Ignoring a parameter with match
- Using match with an enum
- Let's really make the function simple
- Matching
- Patterns and matching
- The two questions you should be asking
- Accessing enumeration members
- Enumerations
- Back to the unit-like struct
- The single element tuple struct
- Tuple structs – the hybrid of two
- Destructuring with let
- Tuple indexing
- Using a tuple to define a variable
- Tuples
- Structs 102
- Private versus public fields
- Multi-file version
- Defining the child structures
- Accessing a struct
- Smaller is better
- The structure of a struct
- Variables variables everywhere
- Structs 101
- Matching and Structures
- Summary
- Output
- Rotation caveat
- Bitwise rotation
- Project 4 – memory
- Input and output
- Using regular expressions (regex)
- Auto-documentation
- Testing criteria
- Formulae for calculations
- User-defined shape
- Volume or area
- Shape types
- Project 3 – area and volume
- Code notes
- Requirements
- Project 2 - some text manipulation
- Application output
- Supplied data
- Requirements
- Project 1 - let's start with some math
- Creating Your Own Rust Applications
- Summary
- Stop the race...
- Let's not race ahead!
- Let's revisit some old code
- Comparison to C
- An owned pointer example
- Garbage collecting time and ownership
- Static memory allocation
- What about functions with arguments?
- Deallocation
- Let's consider the heap
- What is meant by the stack?
- The stack frame
- Let's start at the beginning
- Remember Remember
- Summary
- What is the difference between having and not having a semicolon?
- Recursive functions
- Using loop labels
- Prematurely terminating a loop
- The while condition
- The simple loop
- The _ parameter
- Using enumerate
- The for loop
- Loops
- Conditions Recursion and Loops
- Summary
- Writing a file
- Reading a file
- XML and Rust
- The use of expect
- Writing a file
- Loading a file
- Reading from a file
- Handling files
- Command-line arguments
- Getting information in
- Formatting parameters
- Formatting traits
- Specifying the argument types
- Named parameters
- Positioning the output
- Controlling the output formatting
- The libraries
- Introduction to the standard library
- The difference between println! and println
- Functions and methods in Rust
- Input and Output
- Summary
- A practical example
- The reference type
- Passing by reference
- Passing by value
- Passing values around
- Manipulating an array or vector via slices
- Adding and removing from the vector
- Creating a vector via an iterator
- Creating a vector with an initial size
- Vectors
- Array performance
- Arrays
- Generics and arrays
- String methods
- Casting
- Code review
- Building a string
- Using the format! macro
- What's with the warnings?
- String slices
- Back to Strings
- How Rust uses memory
- Strings
- Defining the variable value before use
- Const and static
- Signed and unsigned integers
- Float
- Defining other variable types
- How can we tell the compiler that we want x to be an int?
- Creating a variable
- Variable mutability
- Variables
- Summary
- Is there anything Cargo can't do?
- Assert yourself!
- Using Cargo to help with your unit testing
- rustdoc versus Cargo
- Creating documentation using Cargo
- Cleaning your source tree with Cargo
- Using Cargo to build and run an application
- Creating a binary package using Cargo
- Automating things
- Structure of a Rust project
- Your first Rust project
- Integrated Development Environment
- Testing your installation
- gcc prerequisites
- Installing rustup on Linux
- Installing Rust
- Introducing and Installing Rust
- Questions
- Piracy
- Errata
- Downloading the example code
- Customer support
- Reader feedback
- Conventions
- Who this book is for
- What you need for this book
- What this book covers
- Preface
- Title Page
- Customer Feedback
- Why subscribe?
- www.PacktPub.com
- About the Reviewer
- About the Authors
- Credits
- 版權(quán)信息
- 封面
- 封面
- 版權(quán)信息
- Credits
- About the Authors
- About the Reviewer
- www.PacktPub.com
- Why subscribe?
- Customer Feedback
- Title Page
- Preface
- What this book covers
- What you need for this book
- Who this book is for
- Conventions
- Reader feedback
- Customer support
- Downloading the example code
- Errata
- Piracy
- Questions
- Introducing and Installing Rust
- Installing Rust
- Installing rustup on Linux
- gcc prerequisites
- Testing your installation
- Integrated Development Environment
- Your first Rust project
- Structure of a Rust project
- Automating things
- Creating a binary package using Cargo
- Using Cargo to build and run an application
- Cleaning your source tree with Cargo
- Creating documentation using Cargo
- rustdoc versus Cargo
- Using Cargo to help with your unit testing
- Assert yourself!
- Is there anything Cargo can't do?
- Summary
- Variables
- Variable mutability
- Creating a variable
- How can we tell the compiler that we want x to be an int?
- Defining other variable types
- Float
- Signed and unsigned integers
- Const and static
- Defining the variable value before use
- Strings
- How Rust uses memory
- Back to Strings
- String slices
- What's with the warnings?
- Using the format! macro
- Building a string
- Code review
- Casting
- String methods
- Generics and arrays
- Arrays
- Array performance
- Vectors
- Creating a vector with an initial size
- Creating a vector via an iterator
- Adding and removing from the vector
- Manipulating an array or vector via slices
- Passing values around
- Passing by value
- Passing by reference
- The reference type
- A practical example
- Summary
- Input and Output
- Functions and methods in Rust
- The difference between println! and println
- Introduction to the standard library
- The libraries
- Controlling the output formatting
- Positioning the output
- Named parameters
- Specifying the argument types
- Formatting traits
- Formatting parameters
- Getting information in
- Command-line arguments
- Handling files
- Reading from a file
- Loading a file
- Writing a file
- The use of expect
- XML and Rust
- Reading a file
- Writing a file
- Summary
- Conditions Recursion and Loops
- Loops
- The for loop
- Using enumerate
- The _ parameter
- The simple loop
- The while condition
- Prematurely terminating a loop
- Using loop labels
- Recursive functions
- What is the difference between having and not having a semicolon?
- Summary
- Remember Remember
- Let's start at the beginning
- The stack frame
- What is meant by the stack?
- Let's consider the heap
- Deallocation
- What about functions with arguments?
- Static memory allocation
- Garbage collecting time and ownership
- An owned pointer example
- Comparison to C
- Let's revisit some old code
- Let's not race ahead!
- Stop the race...
- Summary
- Creating Your Own Rust Applications
- Project 1 - let's start with some math
- Requirements
- Supplied data
- Application output
- Project 2 - some text manipulation
- Requirements
- Code notes
- Project 3 – area and volume
- Shape types
- Volume or area
- User-defined shape
- Formulae for calculations
- Testing criteria
- Auto-documentation
- Using regular expressions (regex)
- Input and output
- Project 4 – memory
- Bitwise rotation
- Rotation caveat
- Output
- Summary
- Matching and Structures
- Structs 101
- Variables variables everywhere
- The structure of a struct
- Smaller is better
- Accessing a struct
- Defining the child structures
- Multi-file version
- Private versus public fields
- Structs 102
- Tuples
- Using a tuple to define a variable
- Tuple indexing
- Destructuring with let
- Tuple structs – the hybrid of two
- The single element tuple struct
- Back to the unit-like struct
- Enumerations
- Accessing enumeration members
- The two questions you should be asking
- Patterns and matching
- Matching
- Let's really make the function simple
- Using match with an enum
- Ignoring a parameter with match
- Fall through patterns
- Ranges
- Creating a binding within a match pattern
- Let's add an if into the mix
- Using match with a compound type
- And back to if let
- Summary
- The Rust Application Lifetime
- What are they?
- Ownership
- Borrowing
- Lifetime
- Ownership in Rust
- Abstractions
- Ownership – from the beginning
- Variable binding
- Stack and heap variables
- Why is this important?
- The Copy trait
- Borrowing in Rust
- Borrow immutability
- Mutable borrows
- The Rust borrowing rules
- Fixing the problem
- Think about the scope
- It's all for your own good
- The lifetime
- The mythical bank account
- The lifetime variable - '
- Lifetime of other types
- Lifetime within an struct
- Multiple lifetimes
- Always consider the scope
- 'struct
- Input and output lifetimes
- Input only
- Output only
- Input and output
- Summary
- Introducing Generics Impl and Traits
- Generics 101
- Understanding the error
- A generic problem
- The unsafe directive
- The whole #!
- Traits and Impl
- Impl
- The impl lifetime
- And back to traits we go...
- A simple crate example
- Traits and generics
- Defining the impl for specific types
- Using where
- Making it work
- Something you may have noticed
- Generics - a small aside
- So what does happen?
- Back to the where version
- Try to compile
- Trait bounds
- Can we reduce the amount of code further?
- Can the default method be overridden?
- Rounding off traits
- Inheritance
- Deriving
- Trait objects
- Let's create a sample test setup
- Let's see dynamic dispatch
- Keeping your object safe
- Summary
- Creating Your Own Crate
- What exactly is a crate?
- Looking at modules
- I can see a problem with this analogy
- Back to our math library
- Using a useful name
- Let's create!
- Creating top-level modules
- The multifile module
- What about submodules?
- The mod.rs file
- Let's add some code
- Beware of double name scopes
- Adding unit tests to the library
- Making something public
- Let's give our crate a quick run out
- External dependencies
- Changing the scope
- Altering the crate name
- Optimizing your use statements
- The use-everything approach
- The you-decide approach
- The use-me approach
- The use-me-but-call-me-something-else approach
- The use-glob approach
- The use-glob-self approach
- Summary
- Concurrency in Rust
- A bit of a story
- What was that all about?
- Send
- Sync
- When is an immutable variable not an immutable variable?
- And it's obviously mutable it has mut in the definition
- Interior mutability
- Back to sync
- A beginner's guide to threading in Rust
- An easy approach to thinking about how threads work.
- Joining threads
- Closures
- Closures aren't all they first appear to be
- Closures as function arguments
- Closures with explicit lifetimes – a special case
- Returning a closure
- What is the move parameter?
- Back to threading
- Ownership has its advantages
- The reference counter
- Problem solved – use Mutex
- Why do we put the thread to sleep?
- Thread synchronization
- Thread panics
- Summary
- Now It's Your Turn!
- Task 1 – cleaning the code (part 1)
- The problems with each option
- The String option
- The struct option
- The task
- Task 2 – cleaning the code (part 2)
- The task
- Task 3 – extending the crate (part 1)
- The task
- Task 4 – extending the crate (part 2)
- Summary
- The Standard Library
- Chapter format
- What is the standard library?
- The standard modules (overview)
- Primitive types (overview)
- Macros (overview)
- Prelude
- The standard modules
- std::Any
- std::ascii
- std::borrow
- std::boxed
- std::cell
- std::char
- std::clone
- std::cmp
- std::collections
- std::convert
- std::default
- std:env
- std:error
- std::f32
- std::f64
- std:ffi
- std::fmt
- std::fs
- std::hash
- std::i8
- std::i16
- std::i32
- std::i64
- std::io
- std::isize
- std::iter
- std::marker
- std::mem
- std:net
- std::num
- std::os
- std::panic
- std::path
- std::process
- std::ptr
- std::slice
- std::str
- std::string
- std::sync
- std::thread
- std::time
- std::u8
- std::u16
- std::u32
- std::u64
- std::usize
- std::vec
- Summary
- Foreign Function Interfaces
- Introducing our simple library
- The three-step program
- Including the dependency
- Creating the code
- What's the [link(name="")] for?
- What's the big deal? That was simple enough!
- Let's extend things a bit
- What happens if the types don't match?
- Can we make things safer?
- Wrappers
- A practical example
- Accessing global variables
- Cleaning up after yourself
- Drop it!
- Monitoring an external process within an FFI
- Targeting synchronous callbacks
- Targeting a Rust object
- Calling Rust from another language
- Dealing with the unknown
- C structs
- Summary 更新時(shí)間:2021-07-02 23:08:10