Cleanup, clippy
[?]
Sep 17, 2021, 8:46 AM
JPTYS433ESGA2UUNKQT4JMAWFU7KVIU7F5RKDZTUR7RR5A2COBVQCDependencies
- [2]
OK5CKW6ERework everything, use references - [3]
Y4AQJ5RDOther defaults - [4]
C5VVJ5SOPrint how many rows - [5]
5TH3AA4610 mm extra space - [6]
VSG6UWDYCan now build floors - [7]
6ODVKCN4Fix printouts of relative lengths - [8]
B75B3UUKCreate a MaterialStorage - [9]
U4JRHEA7fmt - [10]
ZJPL7VNQSeparate planks from main - [11]
ES2PMPT4Using structures instead - [12]
CT3VONTOIntroduce PLANKMIN and work with the neverending rows - [13]
SMYRM2CFUse the MaterialStorage - [14]
USO5PZWOStart with the print function, separate mutable and immutable functions - [15]
LXMNVVD2Change to proper measurements - [16]
MLUGR2LLAdd default impl and some basic plank logic - [17]
RQRFFUF6Can build the first basic row - [18]
DBIA6R5XFix get_plank()
Change contents
- edit in src/bin/main.rs at line 20
//let oldstuff = Plank {//length: 1000,//endpiece: false,//new: false,//};//let oldstuff2 = Plank {//length: 1000,//endpiece: false,//new: false,//};//ms.store_used(oldstuff);//ms.store_used(oldstuff2); - replacement in src/bin/main.rs at line 48
fn floor_print(floor: &Floor, ms: &MaterialStorage) -> () {fn floor_print(floor: &Floor, ms: &MaterialStorage) { - replacement in src/bin/main.rs at line 86
fn floor_build(floor: &mut Floor, mut ms: &mut MaterialStorage) -> () {fn floor_build(floor: &mut Floor, mut ms: &mut MaterialStorage) { - replacement in src/bin/main.rs at line 95
return ();return; - replacement in src/bin/main.rs at line 126
if plank.length() > (ROOMLENGTH - row.get_coverage()) {// Cut the plank to lengthlet (plankpart, leftover) = plank.cut_to_length(ROOMLENGTH - row.get_coverage());match plank.length() {length if length < (ROOMLENGTH - row.get_coverage()) => {// Cut the plank to lengthlet (plankpart, leftover) = plank.cut_to_length(ROOMLENGTH - row.get_coverage()); - replacement in src/bin/main.rs at line 131[3.1797]→[3.1797:1857](∅→∅),[3.1857]→[3.103:149](∅→∅),[3.149]→[3.4237:4287](∅→∅),[3.197]→[3.1857:1889](∅→∅),[3.4287]→[3.1857:1889](∅→∅),[3.1857]→[3.1857:1889](∅→∅),[3.1889]→[2.1805:1901](∅→∅),[3.724]→[3.4288:4433](∅→∅),[2.1901]→[3.4288:4433](∅→∅),[3.1969]→[3.4288:4433](∅→∅)
// Add the remainder of plank to the row (move)// also increase the row coveragerow.add_coverage(plankpart.length());row.add(plankpart);// Add the remaining plank to material storagems.store_used(leftover);} else if plank.length() == ROOMLENGTH - row.get_coverage() {// If the plank is the same length as the room, no need to cut// Add the remainder of plank to the row (move)// also increase the row coveragerow.add_coverage(plankpart.length());row.add(plankpart);// Add the remaining plank to material storagems.store_used(leftover);}length if length == (ROOMLENGTH - row.get_coverage()) => {// If the plank is the same length as the room, no need to cut - replacement in src/bin/main.rs at line 141
// Use the whole plank, add to row coveragerow.add_coverage(plank.length());row.add(plank);// Use the whole plank, add to row coveragerow.add_coverage(plank.length());row.add(plank); - replacement in src/bin/main.rs at line 145[3.4565]→[3.4565:4610](∅→∅),[3.4610]→[2.1902:1942](∅→∅),[2.1942]→[3.335:370](∅→∅),[3.4664]→[3.335:370](∅→∅),[3.4694]→[3.4694:4772](∅→∅)
// Take a new plank and continueplank = ms.try_get_used()?;row.add_used_planks();} else {// Plank is shorter than the room, need multiple// Take a new plank and continueplank = ms.try_get_used()?;row.add_used_planks();}_ => {// Plank is shorter than the room, need multiple - replacement in src/bin/main.rs at line 152
// Use the whole plank, add to row coveragerow.add_coverage(plank.length());row.add(plank);// Use the whole plank, add to row coveragerow.add_coverage(plank.length());row.add(plank); - replacement in src/bin/main.rs at line 156[3.4904]→[3.4904:4949](∅→∅),[3.4949]→[2.1943:1983](∅→∅),[2.1983]→[3.371:406](∅→∅),[3.5003]→[3.371:406](∅→∅)
// Take a new plank and continueplank = ms.try_get_used()?;row.add_used_planks();// Take a new plank and continueplank = ms.try_get_used()?;row.add_used_planks();} - replacement in src/constants.rs at line 12
pub static PLAY: u32 = 5;pub static PLAY: u32 = 10; - replacement in src/constants.rs at line 24
pub static AVAILABLEPLANKS: u32 = 30;[2.2632]pub static AVAILABLEPLANKS: u32 = 40; - replacement in src/lib.rs at line 3
use constants::{PLANKMAX, PLANKMIN, SAWBLADE, AVAILABLEPLANKS};use constants::{AVAILABLEPLANKS, PLANKMAX, PLANKMIN, SAWBLADE}; - replacement in src/lib.rs at line 15
/// Create a new, default storage/// Create a new, default storage - replacement in src/lib.rs at line 70
length: u32,endpiece: bool,new: bool,pub length: u32,pub endpiece: bool,pub new: bool, - replacement in src/lib.rs at line 99
pub fn set_endpiece(&mut self) -> () {pub fn set_endpiece(&mut self) { - replacement in src/lib.rs at line 170
pub fn set_full(&mut self) -> () {pub fn set_full(&mut self) { - replacement in src/lib.rs at line 174
pub fn set_first_and_last_as_endpieces(&mut self) -> () {pub fn set_first_and_last_as_endpieces(&mut self) { - replacement in src/lib.rs at line 196
pub fn add_used_planks(&mut self) -> () {pub fn add_used_planks(&mut self) { - replacement in src/lib.rs at line 201
pub fn add_coverage(&mut self, coverage: u32) -> () {pub fn add_coverage(&mut self, coverage: u32) { - replacement in src/lib.rs at line 210
pub fn add(&mut self, plank: Plank) -> () {pub fn add(&mut self, plank: Plank) { - replacement in src/lib.rs at line 240
pub fn set_complete(&mut self) -> () {pub fn set_complete(&mut self) { - replacement in src/lib.rs at line 265
pub fn add(&mut self, row: Row) -> () {pub fn add(&mut self, row: Row) { - replacement in src/lib.rs at line 275
pub fn add_coverage(&mut self, coverage: u32) -> () {pub fn add_coverage(&mut self, coverage: u32) {