Comments (2)
How about an exercise involving implementing a trait and then contrasting that with the option to
#[derive(Trait)]
Something along the lines of:
use std::fmt;
struct Point {
x: i32,
y: i32,
}
impl fmt::Debug for Point {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Point {{ x: {}, y: {} }}", self.x, self.y)
}
}
let origin = Point { x: 0, y: 0 };
println!("The origin is: {:?}", origin);
vs
#[derive(Debug)]
struct Point {
x: i32,
y: i32,
}
let origin = Point { x: 0, y: 0 };
println!("The origin is: {:?}", origin);
from rustlings.
I don't know if the idea was to have more of these than what exists but https://github.com/carols10cents/rustlings/blob/master/ex3.rs already exists for this. It is a very minimal example to show off the very concept of #[derive(Debug)]. Unless there is a specific need for an issue just like this again, I feel like this could be closed.
from rustlings.
Related Issues (20)
- Rustlings initialisation failed -- arch linux HOT 5
- rustlings command not found HOT 1
- Exercise file links won't open in WSL HOT 1
- as_ref_mut.rs weird error using provided solution HOT 1
- What happened to nix? HOT 1
- Rustlings failed to compile: E0658 HOT 3
- Stuck with 00_into/intro1.rs, no such command: 'clippy' HOT 7
- issue reinstalling rustlings v6.0.1 -> 6.1.0 HOT 1
- No "init" option for rustlings HOT 2
- How does the solution for move_semantic3 work? HOT 3
- Would it make sense to add an additional exercise to move_semantics?
- Option to show solution after completing an exercise. HOT 3
- Rustlings couldn't install HOT 1
- `rustlings` crashes when `solutions/` doesnโt exist HOT 1
- TOML parse error at line 1, column 1 | 1 | # INTRO | ^ missing field `format_version` HOT 6
- error[E0658]: use of unstable library feature 'result_option_inspect' HOT 4
- Checking an exercise takes too long HOT 8
- LSP issues because of too many errors HOT 2
- rustlings init in a workspace HOT 3
- I'm having trouble at enums2.rs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rustlings.