webpack wasm challengeINTRODUCTION WEBASSEMBLY AND ESM ## WEBASSEMBLY? • Low-Level BINARY FORMAT FOR CODE • TYPED (I8 – I64, F32, F64) - MEMORY • USUALLY COMPILED FROM NATIVE LANGUAGES (C/C++, Rust, ...) • ASSEMBLY-LIKE INSTEAD OF WASM ## CHALLENGE 5: I64 • WebAssembly HAS THIS NICE 64-bit Integer Data Type - JAVALSCRIPT CAN'T HANDLE IT (CURRENTLY) $ ^{*} $ • ANY FUNCTION WITH i64 IN SIGNATURE WILL CRASH IN JS (RuntimeError) COLLECTION AND STRUCTURED OBJECTS • WE MAY NEED TO HANDLE THIS ON BOUNDARIES ## THE FUTURE • BigInt FOR i64 • CODE Splitting construct for WASM JS HAS import("module"). Do WE NEED A CONSTRUCT FOR WASM0 码力 | 39 页 | 6.70 MB | 2 年前3
Rust算法教程 The Algos (algorithms)}; ## 最小生成树 use std::vec::Vec; #[derive(Debug)] pub struct Edge { source: i64, destination: i64, cost: i64, } impl PartialEq for Edge { fn eq(&self, other: &Self) -> bool new(source: i64, destination: i64, cost: i64) -> Self { Self { source, destination, cost, } } } fn make_sets(number_of_vertices: i64) -> VecVec<i64> { let mut parent: Vec<i64> = Vec::with_capacity(number_of_vertices as usize); for i in 0..number_of_vertices { parent.push(i); } parent } fn find(parent: &mut Vec 0 码力 | 270 页 | 8.46 MB | 2 年前3
Comprehensive Rust(English) 202412of each type. ||Types|Literals| |---|---|---| |Signed integers|i8, i16, i32, i64, i128, isize|-10, 0, 1\_000, 123\_i64| |Unsigned integers|u8, u16, u32, u64, u128, usize|0, 123, 10\_u16| |Floating point left: Box, right: Box /// A literal value Value(i64), } The Box type here is a smart pointer, and will be covered in detail later in the course. An expression Box}, , right: Box }, /// A literal value Value(i64), } fn eval(e: Expression) -> Result<i64, string=""> { todo!() } fn test_value() { assert_eq!(eval(Expression::Value(19)) 0 码力 | 382 页 | 1.00 MB | 1 年前3
Comprehensive Rust(简体中文) 202412### 5.3 值 以下是一些基本的内置类型以及每种类型的字面量值的语法。 ||类型|字面量| |---|---|---| |有符号整数|i8、i16、i32、i64、i128、isize|-10、0、1\_000、123\_i64| |无符号整数|u8、u16、u32、u64、u128、usize|0、123、10\_u16| |浮点数|f32、f64|3.14、-10.0e20、2\_f32| Box, right: Box op: Operation::Mul, left: Box::new(Expression::Op { op: Operation::Sub}, /// A literal value Value(i64), } fn eval(e: Expression) -> Result<i64, string=""> { todo!() } fn test_value() { assert_eq!(eval(Expression::Value(19)) left: Box::new(Expression::Value(10)), right: Box::new(Expression::Value(9)), }; } ```i64,> 0 码力 | 359 页 | 1.33 MB | 1 年前3
Comprehensive Rust(繁体中文)### 5.3 值 以下列出一些基本的內建型別,以及適用於各型的字面常量的語法。 ||類型|常值| |---|---|---| |帶號整數|i8、i16、i32、i64、i128、isize|-10、0、1\_000、123\_i64| |非帶號整數|u8、u16、u32、u64、u128、usize|0、123、10\_u16| |浮點數|f32、f64|3.14、-10.0e20、2\_f32| Box, right: Box right: Box::new(Expression::Value(9)), let term2 = Expression::Op}, /// A literal value Value(i64), } fn eval(e: Expression) -> Result<i64, string=""> { todo!() } fn test_value() { assert_eq!(eval(Expression::Value(19)) Expression::Op { op: Operation::Mul, left: Box::new(Expression::Value(10)), } }i64,> 0 码力 | 358 页 | 1.41 MB | 1 年前3
Comprehensive Rust(繁体中文) 202406### 5.3 值 以下列出一些基本的內建型別,以及適用於各型的字面常量的語法。 ||類型|常值| |---|---|---| |帶號整數|i8、i16、i32、i64、i128、isize|-10、0、1\_000、123\_i64| |非帶號整數|u8、u16、u32、u64、u128、usize|0、123、10\_u16| |浮點數|f32、f64|3.14、-10.0e20、2\_f32| Box, right: Box right: Box::new(Expression::Value(9)), let term2 = Expression::Op}, /// A literal value Value(i64), } fn eval(e: Expression) -> Result<i64, string=""> { todo!() } fn test_value() { assert_eq!(eval(Expression::Value(19)) Expression::Op { op: Operation::Mul, left: Box::new(Expression::Value(10)), } }i64,> 0 码力 | 356 页 | 1.41 MB | 1 年前3
Comprehensive Rust(Ukrainian) 202412Operation, left: Box, right: Box , right: Box}, /// Літеральне значення Value(i64), } Тип Вох тут с розумним вказівником і буде детально розглянутий пізніше у курсі. Вираз може бути Літеральне значення Value(i64), } fn eval(e: Expression) -> Result<i64, string=""> { todo!( } } fn test_value() { assert_eq!(eval(Expression::Value(19)), Ok(19)); }i64,> }, /// Літеральне значення Value(i64), } fn eval(e: Expression) -> Result<i64, string=""> { match e { Expression::Op { op, left, right } => 0 码力 | 396 页 | 1.08 MB | 1 年前3
Comprehensive Rust ?of each type. ||Types|Literals| |---|---|---| |Signed integers|i8, i16, i32, i64, i128, isize|-10, 0, 1\_000, 123\_i64| |Unsigned integers|u8, u16, u32, u64, u128, usize|0, 123, 10\_u16| |Floating point Box, right: Box fn test_recursion() { let term1 = Expression::Op {}, /// A literal value Value(i64), } fn eval(e: Expression) -> Result<i64, string=""> { todo!() } fn test_value() { assert_eq!(eval(Expression::Value(19)) ue(10)), right: Box::new(Expression::Value(20)), }), Ok(30) ); }i64,> 0 码力 | 378 页 | 1009.46 KB | 2 年前3
Comprehensive Rust(Português do Brasil) 202412cada tipo. ||Tipos|Literais| |---|---|---| |Inteiros com sinal|i8, i16, i32, i64, i128, isize|-10, 0, 1\_000, 123\_i64| |Inteiros sem sinal|u8, u16, u32, u64, u128, usize|0, 123, 10\_u16| |Números de right: Box}, /// Um valor literal Value(i64), } fn eval(e: Expression) -> Result<i64, string=""> { todo!() }i64,> fn test_value() { assert_eq Box, right: Box }, /// Um valor literal Value(i64), } fn eval(e: Expression) -> Result<i64, string=""> { match e { Expression::Op { op, left, right } => 0 码力 | 389 页 | 1.05 MB | 1 年前3
Comprehensive Rust(Español) 202412literales de cada tipo. ||Tipos|Literales| |---|---|---| |Enteros|i8, i16, i32, i64, i128,|-10, 0, 1\_000, 123\_i64| |con signo|isize|| |Enteros|u8, u16, u32, u64, u128,|0, 123, 10\_u16| |sin signo|usize|| Box}, /// Un valor literal Value(i64), fn eval(e: Expression) -> Result<i64, string=""> { todo!() } fn test_value() { assert_eq!(eval(Expression::Value(19)) assert_eq!( eval(Expression::Op { op: Operation::Div, } ); }i64,> left: Box::new(Expression::Value(99)), right: Box::new(Expression::Value(0)), }, Err(String::from("división0 码力 | 389 页 | 1.04 MB | 1 年前3
共 161 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17













