Report is mostly done now, fine tuning left
This commit is contained in:
parent
fb5aa5ee5a
commit
06b71b8688
21 changed files with 533 additions and 225 deletions
12
tex/code/compiler-help
Normal file
12
tex/code/compiler-help
Normal file
|
@ -0,0 +1,12 @@
|
|||
error[E0412]: cannot find type `Json` in this scope
|
||||
--> src/component/login.rs:6:16
|
||||
|
|
||||
6 | fn create() -> Json {}
|
||||
| ^^^^ not found in this scope
|
||||
|
|
||||
help: possible candidates are found in other modules, you can import them into scope
|
||||
|
|
||||
1 | use yew::format::Json;
|
||||
|
|
||||
1 | use yew::format::json::Json;
|
||||
|
|
34
tex/code/trait.rs
Normal file
34
tex/code/trait.rs
Normal file
|
@ -0,0 +1,34 @@
|
|||
trait Muoto {
|
||||
fn pinta_ala(&self) -> u32;
|
||||
}
|
||||
|
||||
struct Suorakulmio {
|
||||
x: u32,
|
||||
y: u32,
|
||||
}
|
||||
|
||||
struct Ympyra {
|
||||
r: f64,
|
||||
}
|
||||
|
||||
impl Muoto for Suorakulmio {
|
||||
fn pinta_ala(&self) -> u32 {
|
||||
self.x * self.y
|
||||
}
|
||||
}
|
||||
|
||||
impl Muoto for Ympyra {
|
||||
fn pinta_ala(&self) -> u32 {
|
||||
(3.141 * self.r * self.r) as u32
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let muoto1 = Suorakulmio { x: 15, y: 10 };
|
||||
let muoto2 = Ympyra { r: 8.5 };
|
||||
println!("Suorakulmion pinta-ala: {}", muoto1.pinta_ala());
|
||||
println!("Ympyrän pinta-ala: {}", muoto2.pinta_ala());
|
||||
}
|
||||
|
||||
// Suorakulmion pinta-ala: 150
|
||||
// Ympyrän pinta-ala: 226
|
Loading…
Add table
Add a link
Reference in a new issue