mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-06 01:53:30 +02:00
Clean up and unify exercises
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
// traits1.rs
|
||||
//
|
||||
// Time to implement some traits! Your task is to implement the trait
|
||||
// `AppendBar` for the type `String`. The trait AppendBar has only one function,
|
||||
// which appends "Bar" to any object implementing this trait.
|
||||
//
|
||||
// Execute `rustlings hint traits1` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
trait AppendBar {
|
||||
fn append_bar(self) -> Self;
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
// traits2.rs
|
||||
//
|
||||
// Your task is to implement the trait `AppendBar` for a vector of strings. To
|
||||
// implement this trait, consider for a moment what it means to 'append "Bar"'
|
||||
// to a vector of strings.
|
||||
//
|
||||
// No boiler plate code this time, you can do this!
|
||||
//
|
||||
// Execute `rustlings hint traits2` or use the `hint` watch subcommand for a hint.
|
||||
|
||||
trait AppendBar {
|
||||
fn append_bar(self) -> Self;
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
// traits3.rs
|
||||
//
|
||||
// Your task is to implement the Licensed trait for both structures and have
|
||||
// them return the same information without writing the same function twice.
|
||||
//
|
||||
// Consider what you can add to the Licensed trait.
|
||||
//
|
||||
// Execute `rustlings hint traits3` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
pub trait Licensed {
|
||||
fn licensing_info(&self) -> String;
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
// traits4.rs
|
||||
//
|
||||
// Your task is to replace the '??' sections so the code compiles.
|
||||
//
|
||||
// Don't change any line other than the marked one.
|
||||
//
|
||||
// Execute `rustlings hint traits4` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
pub trait Licensed {
|
||||
fn licensing_info(&self) -> String {
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
// traits5.rs
|
||||
//
|
||||
// Your task is to replace the '??' sections so the code compiles.
|
||||
//
|
||||
// Don't change any line other than the marked one.
|
||||
//
|
||||
// Execute `rustlings hint traits5` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
pub trait SomeTrait {
|
||||
fn some_function(&self) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user