Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(book): replace float with f32 #204

Merged
merged 1 commit into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
# }