Embedding, in the context of this article, is the process of hosting a web rendering engine inside another application. This engine displays content exactly as a regular web browser would, but allows the application author to customize the user’s exp
wasm-pack is a tool that seeks to be a one-stop shop for building and working with Rust generated WebAssembly that you would like to interop with JavaScript. This includes ability to publish modules so that you can share your Rust generated WebAssemb
js-sys offers bindings to all the global APIs available in every JavaScript environment as defined by the ECMAScript standard. In this lesson, we will install and use js-sys to invoke JavaScript's Date API to grab the current time. The date will need
While JavaScript has a garbage-collected heap, WebAssembly has a linear memory space. Nevertheless using a JavaScript ArrayBuffer, we can read and write to WebAssembly’s memory space. lib.rs: #[macro_use] extern crate cfg_if; extern crate wasm_bindge
Having some kind of debugging tool in our belt is extremely useful before writing a lot of code. In this lesson we build a println!()-style syntax using JavaScript’s console.log to be able to log out values in Rust. n JavaScript, the console log fu
写时复制(Copy on Write)技术是一种程序中的优化策略,多应用于读多写少的场景.主要思想是创建对象的时候不立即进行复制,而是先引用(借用)原有对象进行大量的读操作,只有进行到少量的写操作的时候,才进行复制操作,将原有对象复制后再写入.这样的好处是在读多写少的场景下,减少了复制操作,提高了性能. Rust中对应这种思想的是智能指针Cow<T>,定义如下: pub enum Cow<'a, B> where B: 'a + ToOwned + 'a + ?Sized, { B
直接上github: https://github.com/vlang/v 前戏 大概是在6月份的时候,在github上看到了这个玩意,我以为是??? 我下意识的去查了一下有没有人在讨论这个语言,但是关于这货的在国内讨论比较少 噱头如下: Simplicity: the language can be learned in less than an hour (有编程基础的人学起来很简单) Fast compilation: ~100k loc/s right now, ~1.2 million
RefCell Rust在编译阶段会进行严格的借用规则检查,规则如下: 在任意给定时间,要么只能有一个可变引用,要么只能有多个不可变引用. 引用必须总是有效. 即在编译阶段,当有一个不可变值时,不能可变的借用它.如下代码所示: fn main() { let x = 5; let y = &mut x; } 会产生编译错误: error[E0596]: cannot borrow immutable local variable `x` as mutable --> src/main.rs: