Skip to content

Commit

Permalink
docs(book): replace float with f32
Browse files Browse the repository at this point in the history
  • Loading branch information
Wodann committed May 25, 2020
1 parent 3f67612 commit ca21548
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions book/listings/ch03-structs/listing01.mun
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct Vector2 {
x: float,
y: float,
x: f32,
y: f32,
}
2 changes: 1 addition & 1 deletion book/listings/ch03-structs/listing02.mun
Original file line number Diff line number Diff line change
@@ -1 +1 @@
struct Vector3(float, float, float)
struct Vector3(f32, f32, f32)
4 changes: 2 additions & 2 deletions book/listings/ch03-structs/listing03.mun
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# struct Vector2 {
# x: float,
# y: float,
# x: f32,
# y: f32,
# }
let xy = Vector2 {
x: 1.0,
Expand Down
2 changes: 1 addition & 1 deletion book/listings/ch03-structs/listing04.mun
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# struct Vector3(float, float, float)
# struct Vector3(f32, f32, f32)
let xyz = Vector3(-1.0, 0.0, 1.0);
6 changes: 3 additions & 3 deletions book/listings/ch03-structs/listing05.mun
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# struct Vector2 {
# x: float,
# y: float,
# x: f32,
# y: f32,
# }
pub fn vector2_new(x: float, y: float) -> Vector2 {
pub fn vector2_new(x: f32, y: f32) -> Vector2 {
Vector2 { x, y }
}
4 changes: 2 additions & 2 deletions book/listings/ch03-structs/listing06.mun
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# struct Vector2 {
# x: float,
# y: float,
# x: f32,
# y: f32,
# }
pub fn vector2_add(lhs: Vector2, rhs: Vector2) -> Vector2 {
lhs.x += rhs.x;
Expand Down
2 changes: 1 addition & 1 deletion book/listings/ch03-structs/listing07.mun
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# struct Vector3(float, float, float)
# struct Vector3(f32, f32, f32)
pub fn vector3_add(lhs: Vector3, rhs: Vector3) -> Vector3 {
lhs.0 += rhs.0;
lhs.1 += rhs.1;
Expand Down
4 changes: 2 additions & 2 deletions book/listings/ch03-structs/listing09.mun
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct Vector2 {
x: float,
y: float,
x: f32,
y: f32,
}
4 changes: 2 additions & 2 deletions book/listings/ch03-structs/listing10.mun
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct(value) Vector2 {
x: float,
y: float,
x: f32,
y: f32,
}
4 changes: 2 additions & 2 deletions book/listings/ch03-structs/listing11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main() {
.spawn()
.expect("Failed to spawn Runtime");

let a: StructRef = invoke_fn!(runtime, "vector2_new", -1.0f64, 1.0f64).unwrap();
let b: StructRef = invoke_fn!(runtime, "vector2_new", 1.0f64, -1.0f64).unwrap();
let a: StructRef = invoke_fn!(runtime, "vector2_new", -1.0f32, 1.0f32).unwrap();
let b: StructRef = invoke_fn!(runtime, "vector2_new", 1.0f32, -1.0f32).unwrap();
let added: StructRef = invoke_fn!(runtime, "vector2_add", a, b).unwrap();
}
6 changes: 3 additions & 3 deletions book/listings/ch03-structs/listing12.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# .spawn()
# .expect("Failed to spawn Runtime");
#
let mut xy: StructRef = invoke_fn!(runtime, "vector2_new", -1.0f64, 1.0f64).unwrap();
let x: f64 = xy.get("x").unwrap();
let mut xy: StructRef = invoke_fn!(runtime, "vector2_new", -1.0f32, 1.0f32).unwrap();
let x: f32 = xy.get("x").unwrap();
xy.set("x", x * x).unwrap();
let y = xy.replace("y", -1.0f64).unwrap();
let y = xy.replace("y", -1.0f32).unwrap();
# }

0 comments on commit ca21548

Please sign in to comment.