Skip to content
Snippets Groups Projects
Commit 498efff4 authored by Michael Hauspie's avatar Michael Hauspie
Browse files

Remove the need for the bike parts to be Copy

parent 32f51b11
No related branches found
No related tags found
No related merge requests found
#![doc = include_str!("../README.md")]
#[derive(Debug, Clone, Copy)]
#[derive(Debug)]
pub enum Brake {
Disk,
Pads,
}
#[derive(Debug, Clone, Copy)]
#[derive(Debug)]
pub enum Wheel {
Large,
Small,
}
#[derive(Debug, Clone, Copy)]
#[derive(Debug)]
pub enum Transmission {
Standard,
GearHub,
......@@ -63,8 +63,8 @@ impl BikeBuilder {
/// Builds the bike from the builder.
///
/// Will return an error is the bike builder misses parts
pub fn build(self) -> Result<Bike, String> {
match (self.wheels, self.transmission, self.brakes) {
pub fn build(mut self) -> Result<Bike, String> {
match (self.wheels.take(), self.transmission.take(), self.brakes.take()) {
(Some(w), Some(t), Some(b)) => Ok(Bike {
wheels: w,
transmission: t,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment