NiQin.com is a knowledge open source platform, to help you choose books and read books. This website is based on the Rust web stacks.

NiQin shared an aphorism: 这是极为特殊的历史转折期,物质文明发展到这一步注定了精神(信仰)的缺失,灵魂空虚、物欲横流,人们的精神堕入虚无主义,只能沉浸在金钱物质欲望和肉体感官刺激中,有各种不安和痛苦。多少年轻人也失去了纯真的理想和纯美的爱情。这绝不仅是我们这个星球上的生命的悲剧,而是任何一种生命在文明发展进程中注定的悲哀。生命的意义到底是什么?我们到底该怎样活着? -- 《重大人生启示录 - 前言》
Books & Docs
Books and docs for open source knowledge and technology
Second Jobs
Internet Intelligent Matchmaking Service Platform for your Second Jobs, which aims to match the projects and developers.
New Ideas
Divergent your thinkings, and realize your new ideas
Blog & News
Life & travels, technology & management, AI, BigData, Rust, Python, VR/AR/XR ...
Latest Recommended More ...

Programming Languages The Rustonomicon

rust rust-秘典 rust-死灵书 rust-nomicon rustonomicon

The Rustonomicon is your guidebook to the dark arts of unsafe Rust. It’s also sometimes called “the ’nomicon.” The Rustonomicon digs into all the awful details that you need to understand when writing Unsafe Rust programs. Should you wish a long and happy career of writing Rust programs, you should turn back now and forget you ever saw this book. It is not necessary. However if you intend to write unsafe code — or just want to dig into the guts of the language — this book contains lots of useful information. Unlike The Rust Programming Language, we will be assuming considerable prior knowledge. In particular, you should be comfortable with basic systems programming and Rust. If you don’t feel comfortable with these topics, you should consider reading The Book first. That said, we won’t assume you have read it, and we will take care to occasionally give a refresher on the basics where appropriate. You can skip straight to this book if you want; just know that we won’t be explaining everything from the ground up. This book exists primarily as a high-level companion to The Reference. Where The Reference exists to detail the syntax and semantics of every part of the language, The Rustonomicon exists to describe how to use those pieces together, and the issues that you will have in doing so.

Programming Languages The Rust Reference

rust rust-reference rust-参考手册

The Reference is not a formal spec, but is more detailed and comprehensive than the book. This book is the primary reference for the Rust programming language. It provides three kinds of material: - Chapters that informally describe each language construct and their use. - Chapters that informally describe the memory model, concurrency model, runtime services, linkage model, and debugging facilities. - Appendix chapters providing rationale and references to languages that influenced the design. ### Warning: - This book is incomplete. Documenting everything takes a while. - This document is not normative. It may include details that are specific to rustc itself, and should not be taken as a specification for the Rust language. We intend to produce such a document someday, but this is what we have for now.

Programming Languages Rust Cookbook

rust rust-cookbook rust-code-examples rust-示例

This *Rust Cookbook*: - * Is a collection of simple examples; * That demonstrate good practices to accomplish common programming tasks, using the crates of the Rust ecosystem. [Read more about ](https://rust-cookbook.niqin.com/en-us/about.html)*[Rust Cookbook](https://rust-cookbook.niqin.com/en-us/about.html)*, including tips for how to read the book, how to use the examples, and notes on conventions.

Programming Languages Rust by Example

rust rust-examples rust-by-example

Rust is a modern systems programming language focusing on safety, speed, and concurrency. It accomplishes these goals by being memory safe without using garbage collection. Rust by Example (RBE) is a collection of runnable examples that illustrate various Rust concepts and standard libraries. To get even more out of these examples, don't forget to install Rust locally and check out the official docs. Additionally for the curious, you can also check out the source code for this site. Now let's begin! * Hello World - Start with a traditional Hello World program. * Primitives - Learn about signed integers, unsigned integers and other primitives. * Custom Types - struct and enum. * Variable Bindings - mutable bindings, scope, shadowing. * Types - Learn about changing and defining types. * Conversion * Expressions * Flow of Control - if/else, for, and others. * Functions - Learn about Methods, Closures and High Order Functions. * Modules - Organize code using modules * Crates - A crate is a compilation unit in Rust. Learn to create a library. * Cargo - Go through some basic features of the official Rust package management tool. * Attributes - An attribute is metadata applied to some module, crate or item. * Generics - Learn about writing a function or data type which can work for multiple types of arguments. * Scoping rules - Scopes play an important part in ownership, borrowing, and lifetimes. * Traits - A trait is a collection of methods defined for an unknown type: Self * Macros * Error handling - Learn Rust way of handling failures. * Std library types - Learn about some custom types provided by std library. * Std misc - More custom types for file handling, threads. * Testing - All sorts of testing in Rust. * Unsafe Operations * Compatibility * Meta - Documentation, Benchmarking.

Programming Languages The Rust Programming Language

rust rust-book empowerment 赋能

It wasn’t always so clear, but the Rust programming language is fundamentally about empowerment: no matter what kind of code you are writing now, Rust empowers you to reach farther, to program with confidence in a wider variety of domains than you did before. Take, for example, “systems-level” work that deals with low-level details of memory management, data representation, and concurrency. Traditionally, this realm of programming is seen as arcane, accessible only to a select few who have devoted the necessary years learning to avoid its infamous pitfalls. And even those who practice it do so with caution, lest their code be open to exploits, crashes, or corruption. Rust breaks down these barriers by eliminating the old pitfalls and providing a friendly, polished set of tools to help you along the way. Programmers who need to “dip down” into lower-level control can do so with Rust, without taking on the customary risk of crashes or security holes, and without having to learn the fine points of a fickle toolchain. Better yet, the language is designed to guide you naturally towards reliable code that is efficient in terms of speed and memory usage. Programmers who are already working with low-level code can use Rust to raise their ambitions. For example, introducing parallelism in Rust is a relatively low-risk operation: the compiler will catch the classical mistakes for you. And you can tackle more aggressive optimizations in your code with the confidence that you won’t accidentally introduce crashes or vulnerabilities. But Rust isn’t limited to low-level systems programming. It’s expressive and ergonomic enough to make CLI apps, web servers, and many other kinds of code quite pleasant to write — you’ll find simple examples of both later in the book. Working with Rust allows you to build skills that transfer from one domain to another; you can learn Rust by writing a web app, then apply those same skills to target your Raspberry Pi. This book fully embraces the potential of Rust to empower its users. It’s a friendly and approachable text intended to help you level up not just your knowledge of Rust, but also your reach and confidence as a programmer in general. So dive in, get ready to learn—and welcome to the Rust community! — Nicholas Matsakis and Aaron Turon

Latest Sticky More ...

Programming Languages The Cargo Book

rust cargo cargo-book cargo-手册

Cargo is the [Rust](https://rust-lang.niqin.com/en-us)'s *[package manager](https://cargo-book.niqin.com/en-us/appendix/glossary.html#package-manager '"package manager" (glossary entry)')*. Cargo downloads your Rust [package](https://cargo-book.niqin.com/en-us/appendix/glossary.html#package '"package" (glossary entry)')’s dependencies, compiles your packages, makes distributable packages, and uploads them to [crates.io](https://crates.io/), the Rust community’s *[package registry](https://cargo-book.niqin.com/en-us/appendix/glossary.html#package-registry '"package registry" (glossary entry)')*. A book on Rust’s package manager and build system.

Programming Languages Rust Cookbook

rust rust-cookbook rust-code-examples rust-示例

This *Rust Cookbook*: - * Is a collection of simple examples; * That demonstrate good practices to accomplish common programming tasks, using the crates of the Rust ecosystem. [Read more about ](https://rust-cookbook.niqin.com/en-us/about.html)*[Rust Cookbook](https://rust-cookbook.niqin.com/en-us/about.html)*, including tips for how to read the book, how to use the examples, and notes on conventions.

Web Tide book

rust rust-web tide web-framework

Tide is a minimal and pragmatic Rust web application framework built for rapid development. It comes with a robust set of features that make building async web applications and APIs easier and more fun. This Tide-book is still a work in progress, and will be expanded on over time. All examples in the text are available as [working Tide-projects](https://github.com/http-rs/tide-book/tree/main/examples) Example applications: - [tide-async-graphql-mongodb](https://github.com/zzy/tide-async-graphql-mongodb) - Clean boilerplate for graphql services using tide, rhai, async-graphql, surf, graphql-client, handlebars-rust, jsonwebtoken, and mongodb. - Graphql Services: User register, Salt and hash a password with PBKDF2 , Sign in, JSON web token authentication, Change password, Profile Update, User's query & mutation, and Project's query & mutation. - Web Application: Client request, bring & parse GraphQL data, Render data to template engine(handlebars-rust), Define custom helper with Rhai scripting language. - [surfer](https://github.com/zzy/surfer) - The Blog built on Tide stack, generated from [tide-async-graphql-mongodb](https://github.com/zzy/tide-async-graphql-mongodb). - Backend for graphql services using tide, async-graphql, jsonwebtoken, mongodb and so on. - Frontend for web application using tide, rhai, surf, graphql_client, handlebars-rust, cookie and so on.

Programming Languages Rust by Example

rust rust-examples rust-by-example

Rust is a modern systems programming language focusing on safety, speed, and concurrency. It accomplishes these goals by being memory safe without using garbage collection. Rust by Example (RBE) is a collection of runnable examples that illustrate various Rust concepts and standard libraries. To get even more out of these examples, don't forget to install Rust locally and check out the official docs. Additionally for the curious, you can also check out the source code for this site. Now let's begin! * Hello World - Start with a traditional Hello World program. * Primitives - Learn about signed integers, unsigned integers and other primitives. * Custom Types - struct and enum. * Variable Bindings - mutable bindings, scope, shadowing. * Types - Learn about changing and defining types. * Conversion * Expressions * Flow of Control - if/else, for, and others. * Functions - Learn about Methods, Closures and High Order Functions. * Modules - Organize code using modules * Crates - A crate is a compilation unit in Rust. Learn to create a library. * Cargo - Go through some basic features of the official Rust package management tool. * Attributes - An attribute is metadata applied to some module, crate or item. * Generics - Learn about writing a function or data type which can work for multiple types of arguments. * Scoping rules - Scopes play an important part in ownership, borrowing, and lifetimes. * Traits - A trait is a collection of methods defined for an unknown type: Self * Macros * Error handling - Learn Rust way of handling failures. * Std library types - Learn about some custom types provided by std library. * Std misc - More custom types for file handling, threads. * Testing - All sorts of testing in Rust. * Unsafe Operations * Compatibility * Meta - Documentation, Benchmarking.

Programming Languages Rhai - Embedded Scripting for Rust

rust rhai embedded-scripting embedded-scripting-for-rust

Rhai is an embedded scripting language and evaluation engine for Rust that gives a safe and easy way to add scripting to any application. Targets and builds - * All CPU and O/S targets supported by Rust, including: * WebAssembly (WASM) * `no-std` * Minimum Rust version 1.57 Standard features - * Simple language similar to JavaScript+Rust with dynamic typing. * Fairly efficient evaluation (1 million iterations in 0.3 sec on a single-core, 2.3 GHz Linux VM). * Tight integration with native Rust functions and types, including getters/setters, methods and indexers. * Freely pass Rust values into a script as variables/constants via an external Scope - all clonable Rust types are supported; no need to implement any special trait. Or tap directly into the variable resolution process. * Built-in support for most common data types including booleans, integers, floating-point numbers (including Decimal), strings, Unicode characters, arrays (including packed byte arrays) and object maps. * Easily call a script-defined function from Rust. * Relatively little unsafe code (yes there are some for performance reasons). * Few dependencies - currently only smallvec, num-traits, ahash, bitflags and smartstring. * Re-entrant scripting engine can be made Send + Sync (via the sync feature). * Compile once to AST form for repeated evaluations. * Scripts are optimized (useful for template-based machine-generated scripts). * Easy custom API development via plugins system powered by procedural macros. * Function overloading and operator overloading. * Dynamic dispatch via function pointers with additional support for currying. * Closures (anonymous functions) that can capture shared values. * Some syntactic support for object-oriented programming (OOP). * Organize code base with dynamically-loadable modules, optionally overriding the resolution process. * Serialization/deserialization support via serde (requires the serde feature). * Support for minimal builds by excluding unneeded language features. * A debugging interface. Protected against attacks - * Don't Panic guarantee - Any panic is a bug. Rhai subscribes to the motto that a library should never panic the host system, and is coded with this in mind. * Sand-boxed - the scripting engine, if declared immutable, cannot mutate the containing environment unless explicitly permitted. * Rugged - protected against malicious attacks (such as stack-overflow, over-sized data, and runaway scripts etc.) that may come from untrusted third-party user-land scripts. * Track script evaluation progress and manually terminate a script run. * Passes Miri. For those who actually want their own language - * Use as a DSL. * Disable certain language features such as looping. * Further restrict the language by surgically disabling keywords and operators. * Define custom operators. * Extend the language with custom syntax.

Programming Languages The Rust Programming Language

rust rust-book empowerment 赋能

It wasn’t always so clear, but the Rust programming language is fundamentally about empowerment: no matter what kind of code you are writing now, Rust empowers you to reach farther, to program with confidence in a wider variety of domains than you did before. Take, for example, “systems-level” work that deals with low-level details of memory management, data representation, and concurrency. Traditionally, this realm of programming is seen as arcane, accessible only to a select few who have devoted the necessary years learning to avoid its infamous pitfalls. And even those who practice it do so with caution, lest their code be open to exploits, crashes, or corruption. Rust breaks down these barriers by eliminating the old pitfalls and providing a friendly, polished set of tools to help you along the way. Programmers who need to “dip down” into lower-level control can do so with Rust, without taking on the customary risk of crashes or security holes, and without having to learn the fine points of a fickle toolchain. Better yet, the language is designed to guide you naturally towards reliable code that is efficient in terms of speed and memory usage. Programmers who are already working with low-level code can use Rust to raise their ambitions. For example, introducing parallelism in Rust is a relatively low-risk operation: the compiler will catch the classical mistakes for you. And you can tackle more aggressive optimizations in your code with the confidence that you won’t accidentally introduce crashes or vulnerabilities. But Rust isn’t limited to low-level systems programming. It’s expressive and ergonomic enough to make CLI apps, web servers, and many other kinds of code quite pleasant to write — you’ll find simple examples of both later in the book. Working with Rust allows you to build skills that transfer from one domain to another; you can learn Rust by writing a web app, then apply those same skills to target your Raspberry Pi. This book fully embraces the potential of Rust to empower its users. It’s a friendly and approachable text intended to help you level up not just your knowledge of Rust, but also your reach and confidence as a programmer in general. So dive in, get ready to learn—and welcome to the Rust community! — Nicholas Matsakis and Aaron Turon

Latest Published More ...

Programming Languages The Hitchhiker's Guide to Rust

rust rust-guide rust-实践

本书侧重于实践,通过以下实践过程体现目标。 - 聚焦重要的主题,展示可能的解决方案,提供一个跳板引导读者进入一些更高级的内容(这些内容或许可以在网上或者参考手册中找到); - 以开发中遇到的实际应用问题为导向,以优雅的解决方案为目标,进行完整的实例实践解决方案; - 在实例实践过程中,引入解决方案所涉及的相关 crate,并进行实例开发展示。同时,若有同类 crate,则通过实践过程和实现效果进行比较; - 完整实例,可独立运行,也可整合于实际开发环境; - 对于实例开发中引入的 crate,同步更新于 crate 官方仓库,保持最新版本的深入实践。 本书是受到 rust-lang-nursery 团队的开源书籍项目《Cookin’ with Rust》启发而产生的,并且学习借鉴了它的目录结构。 本书具体内容还在规划中,并未确定。欢迎交流:ask@rusthub.org。

Others Markdown Guide

markdown markdown-guide markdown-指南

Markdown 是一种在 web 上设置文本样式的方法:使用普通文本编辑器编写的标记语言,通过简单的标记语法,它可以使普通文本内容具有一定的格式。 你可以使用 Markdown 对文档的展示格式进行排版:如将文本格式化为粗体或斜体、添加图像,以及创建列表等。大多数情况下,Markdown只是一些普通文本加上一些非字母字符,比如 # 或者 *。 Markdown 文档可以通过一些如 mdBook、gitBook 等应用转换为 HTML、PDF、DOC 等格式,提供给不同的应用场景。 Markdown 的语法简洁明了、学习容易,而且功能比纯文本更强,因此使用非常广泛。如 GitHub、WordPress 等,使用 Markdown 对平台上的写作形式进行样式化,提供了 Markdown 文档直接展示的功能。

Others The mdBook Guide/Documentation

markdown mdbook-guide mdbook-documentation mdbook-指南/文档

Create book from markdown files. Like Gitbook but implemented in Rust. mdBook is a command line tool to create books with Markdown. It is ideal for creating product or API documentation, tutorials, course materials or anything that requires a clean, easily navigable and customizable presentation. - Lightweight Markdown syntax helps you focus more on your content - Integrated search support - Color syntax highlighting for code blocks for many different languages - Theme files allow customizing the formatting of the output - Preprocessors can provide extensions for custom syntax and modifying content - Backends can render the output to multiple formats - Written in Rust for speed, safety, and simplicity - Automated testing of Rust code samples This guide is an example of what mdBook produces. mdBook is used by the Rust programming language project, and The Rust Programming Language book is another fine example of mdBook in action.

Programming Languages The Rust Edition Guide

rust rust-版本指南 rust-edition-guide

Welcome to The Rust Edition Guide! “Editions” are Rust’s way of introducing changes into the language that would not otherwise be backwards compatible. This book explains the concept of 'editions', major new eras in Rust's development. In this guide, we’ll discuss: - What editions are - Which changes are contained in each edition - How to migrate your code from one edition to another

Web Async-graphql Book (GraphQL server for Rust)

rust graphql-rust graphql-server graphql-服务器 async-graphql-book async-graphql-手册

Async-graphql is a GraphQL server-side library implemented in Rust. It is fully compatible with the GraphQL specification and most of its extensions, and offers type safety and high performance. You can define a Schema in Rust and procedural macros will automatically generate code for a GraphQL query. This library does not extend Rust’s syntax, which means that Rustfmt can be used normally. I value this highly and it is one of the reasons why I developed Async-graphql.

Web Juniper Book (GraphQL server for Rust)

rust graphql-rust graphql-server graphql-服务器 juniper-book juniper-手册

Juniper is a GraphQL server library for Rust. Build type-safe and fast API servers with minimal boilerplate and configuration. GraphQL is a data query language developed by Facebook intended to serve mobile and web application frontends. Juniper makes it possible to write GraphQL servers in Rust that are type-safe and blazingly fast. We also try to make declaring and resolving GraphQL schemas as convenient as possible as Rust will allow. Juniper does not include a web server - instead it provides building blocks to make integration with existing servers straightforward. It optionally provides a pre-built integration for the Hyper, Iron, Rocket, and Warp frameworks, including embedded Graphiql for easy debugging. #### Features Juniper supports the full GraphQL query language according to the specification (October 2021), including interfaces, unions, schema introspection, and validations. It does not, however, support the schema language. As an exception to other GraphQL libraries for other languages, Juniper builds non-null types by default. A field of type Vec\<Episode\> will be converted into \[Episode!\]!. The corresponding Rust type for e.g. \[Episode\] would be Option\<Vec\<Option\<Episode\>\>\>.

Programming Languages The Rustonomicon

rust rust-秘典 rust-死灵书 rust-nomicon rustonomicon

The Rustonomicon is your guidebook to the dark arts of unsafe Rust. It’s also sometimes called “the ’nomicon.” The Rustonomicon digs into all the awful details that you need to understand when writing Unsafe Rust programs. Should you wish a long and happy career of writing Rust programs, you should turn back now and forget you ever saw this book. It is not necessary. However if you intend to write unsafe code — or just want to dig into the guts of the language — this book contains lots of useful information. Unlike The Rust Programming Language, we will be assuming considerable prior knowledge. In particular, you should be comfortable with basic systems programming and Rust. If you don’t feel comfortable with these topics, you should consider reading The Book first. That said, we won’t assume you have read it, and we will take care to occasionally give a refresher on the basics where appropriate. You can skip straight to this book if you want; just know that we won’t be explaining everything from the ground up. This book exists primarily as a high-level companion to The Reference. Where The Reference exists to detail the syntax and semantics of every part of the language, The Rustonomicon exists to describe how to use those pieces together, and the issues that you will have in doing so.

Programming Languages The Cargo Book

rust cargo cargo-book cargo-手册

Cargo is the [Rust](https://rust-lang.niqin.com/en-us)'s *[package manager](https://cargo-book.niqin.com/en-us/appendix/glossary.html#package-manager '"package manager" (glossary entry)')*. Cargo downloads your Rust [package](https://cargo-book.niqin.com/en-us/appendix/glossary.html#package '"package" (glossary entry)')’s dependencies, compiles your packages, makes distributable packages, and uploads them to [crates.io](https://crates.io/), the Rust community’s *[package registry](https://cargo-book.niqin.com/en-us/appendix/glossary.html#package-registry '"package registry" (glossary entry)')*. A book on Rust’s package manager and build system.

Programming Languages The Rust Reference

rust rust-reference rust-参考手册

The Reference is not a formal spec, but is more detailed and comprehensive than the book. This book is the primary reference for the Rust programming language. It provides three kinds of material: - Chapters that informally describe each language construct and their use. - Chapters that informally describe the memory model, concurrency model, runtime services, linkage model, and debugging facilities. - Appendix chapters providing rationale and references to languages that influenced the design. ### Warning: - This book is incomplete. Documenting everything takes a while. - This document is not normative. It may include details that are specific to rustc itself, and should not be taken as a specification for the Rust language. We intend to produce such a document someday, but this is what we have for now.

Programming Languages Rust Cookbook

rust rust-cookbook rust-code-examples rust-示例

This *Rust Cookbook*: - * Is a collection of simple examples; * That demonstrate good practices to accomplish common programming tasks, using the crates of the Rust ecosystem. [Read more about ](https://rust-cookbook.niqin.com/en-us/about.html)*[Rust Cookbook](https://rust-cookbook.niqin.com/en-us/about.html)*, including tips for how to read the book, how to use the examples, and notes on conventions.

Web Tide book

rust rust-web tide web-framework

Tide is a minimal and pragmatic Rust web application framework built for rapid development. It comes with a robust set of features that make building async web applications and APIs easier and more fun. This Tide-book is still a work in progress, and will be expanded on over time. All examples in the text are available as [working Tide-projects](https://github.com/http-rs/tide-book/tree/main/examples) Example applications: - [tide-async-graphql-mongodb](https://github.com/zzy/tide-async-graphql-mongodb) - Clean boilerplate for graphql services using tide, rhai, async-graphql, surf, graphql-client, handlebars-rust, jsonwebtoken, and mongodb. - Graphql Services: User register, Salt and hash a password with PBKDF2 , Sign in, JSON web token authentication, Change password, Profile Update, User's query & mutation, and Project's query & mutation. - Web Application: Client request, bring & parse GraphQL data, Render data to template engine(handlebars-rust), Define custom helper with Rhai scripting language. - [surfer](https://github.com/zzy/surfer) - The Blog built on Tide stack, generated from [tide-async-graphql-mongodb](https://github.com/zzy/tide-async-graphql-mongodb). - Backend for graphql services using tide, async-graphql, jsonwebtoken, mongodb and so on. - Frontend for web application using tide, rhai, surf, graphql_client, handlebars-rust, cookie and so on.

Programming Languages Rust by Example

rust rust-examples rust-by-example

Rust is a modern systems programming language focusing on safety, speed, and concurrency. It accomplishes these goals by being memory safe without using garbage collection. Rust by Example (RBE) is a collection of runnable examples that illustrate various Rust concepts and standard libraries. To get even more out of these examples, don't forget to install Rust locally and check out the official docs. Additionally for the curious, you can also check out the source code for this site. Now let's begin! * Hello World - Start with a traditional Hello World program. * Primitives - Learn about signed integers, unsigned integers and other primitives. * Custom Types - struct and enum. * Variable Bindings - mutable bindings, scope, shadowing. * Types - Learn about changing and defining types. * Conversion * Expressions * Flow of Control - if/else, for, and others. * Functions - Learn about Methods, Closures and High Order Functions. * Modules - Organize code using modules * Crates - A crate is a compilation unit in Rust. Learn to create a library. * Cargo - Go through some basic features of the official Rust package management tool. * Attributes - An attribute is metadata applied to some module, crate or item. * Generics - Learn about writing a function or data type which can work for multiple types of arguments. * Scoping rules - Scopes play an important part in ownership, borrowing, and lifetimes. * Traits - A trait is a collection of methods defined for an unknown type: Self * Macros * Error handling - Learn Rust way of handling failures. * Std library types - Learn about some custom types provided by std library. * Std misc - More custom types for file handling, threads. * Testing - All sorts of testing in Rust. * Unsafe Operations * Compatibility * Meta - Documentation, Benchmarking.

Programming Languages Rhai - Embedded Scripting for Rust

rust rhai embedded-scripting embedded-scripting-for-rust

Rhai is an embedded scripting language and evaluation engine for Rust that gives a safe and easy way to add scripting to any application. Targets and builds - * All CPU and O/S targets supported by Rust, including: * WebAssembly (WASM) * `no-std` * Minimum Rust version 1.57 Standard features - * Simple language similar to JavaScript+Rust with dynamic typing. * Fairly efficient evaluation (1 million iterations in 0.3 sec on a single-core, 2.3 GHz Linux VM). * Tight integration with native Rust functions and types, including getters/setters, methods and indexers. * Freely pass Rust values into a script as variables/constants via an external Scope - all clonable Rust types are supported; no need to implement any special trait. Or tap directly into the variable resolution process. * Built-in support for most common data types including booleans, integers, floating-point numbers (including Decimal), strings, Unicode characters, arrays (including packed byte arrays) and object maps. * Easily call a script-defined function from Rust. * Relatively little unsafe code (yes there are some for performance reasons). * Few dependencies - currently only smallvec, num-traits, ahash, bitflags and smartstring. * Re-entrant scripting engine can be made Send + Sync (via the sync feature). * Compile once to AST form for repeated evaluations. * Scripts are optimized (useful for template-based machine-generated scripts). * Easy custom API development via plugins system powered by procedural macros. * Function overloading and operator overloading. * Dynamic dispatch via function pointers with additional support for currying. * Closures (anonymous functions) that can capture shared values. * Some syntactic support for object-oriented programming (OOP). * Organize code base with dynamically-loadable modules, optionally overriding the resolution process. * Serialization/deserialization support via serde (requires the serde feature). * Support for minimal builds by excluding unneeded language features. * A debugging interface. Protected against attacks - * Don't Panic guarantee - Any panic is a bug. Rhai subscribes to the motto that a library should never panic the host system, and is coded with this in mind. * Sand-boxed - the scripting engine, if declared immutable, cannot mutate the containing environment unless explicitly permitted. * Rugged - protected against malicious attacks (such as stack-overflow, over-sized data, and runaway scripts etc.) that may come from untrusted third-party user-land scripts. * Track script evaluation progress and manually terminate a script run. * Passes Miri. For those who actually want their own language - * Use as a DSL. * Disable certain language features such as looping. * Further restrict the language by surgically disabling keywords and operators. * Define custom operators. * Extend the language with custom syntax.