Start with the print function, separate mutable and immutable functions

[?]
Jul 11, 2020, 9:59 PM
USO5PZWOGMYH6BUHQO3AQHDQBQ4EO27OSSAVPUWCUIZVFO3PNFJQC

Dependencies

Change contents

  • replacement in src/floor.rs at line 118
    [3.2330][3.2330:2432]()
    /// Get the number of plank rows for this floor
    pub fn planks(&mut self) -> &mut Vec<Plank> {
    [3.2330]
    [3.2432]
    /// Get a mutable reference to the planks
    pub fn planks_mut(&mut self) -> &mut Vec<Plank> {
  • edit in src/floor.rs at line 121
    [3.2457]
    [3.2457]
    }
    /// Get a mutable reference to the planks
    pub fn planks(&self) -> &Vec<Plank> {
    &self.planks
  • edit in src/floor.rs at line 182
    [3.3423]
    [3.321]
    /// Get a mutable reference to the rows
    pub fn rows_mut(&mut self) -> &mut Vec<Row> {
    &mut self.rows
    }
    /// Get a mutable reference to the rows
    pub fn rows(&self) -> &Vec<Row> {
    &self.rows
    }
  • replacement in src/main.rs at line 31
    [3.538][3.1159:1250]()
    let finished_floor = build_floor(floor);
    println!("Floor: {:#?}", finished_floor);
    [3.297]
    [2.232]
    let finished_floor = floor_build(floor);
    //println!("Floor: {:#?}", finished_floor);
    floor_print(finished_floor);
  • replacement in src/main.rs at line 35
    [2.233][2.233:298]()
    println!("Number of rows: {}", finished_floor.rows_count());
    [2.233]
    [3.1250]
    //println!("Number of rows: {}", finished_floor.rows_count());
  • replacement in src/main.rs at line 38
    [3.355][3.1253:1297]()
    fn build_floor(mut floor: Floor) -> Floor {
    [3.355]
    [3.629]
    fn floor_print(floor: Floor) -> () {
    for row in floor.rows().iter() {
    for plank in row.planks().iter() {
    println!("plank: {:#?}", plank);
    /*
    if planklist[x].0 == ROOMLENGTH {
    println!("|{:-^22}|", ROOMLENGTH);
    } else {
    // If x is odd
    if planklist[x].0 == planklist[x].1 {
    println!("|{:-^10}||{:-^10}|", planklist[x].0, planklist[x].1)
    } else if planklist[x].0 < planklist[x].1 {
    println!("|{:-^7}||{:-^13}|", planklist[x].0, planklist[x].1)
    } else {
    println!("|{:-^13}||{:-^7}|", planklist[x].0, planklist[x].1)
    }
    }
    */
    }
    }
    println!();
    println!("Lycka till!");
    }
    fn floor_build(mut floor: Floor) -> Floor {
  • replacement in src/main.rs at line 130
    [3.5185][3.5185:5237]()
    if let Some(plank) = row.planks().first_mut() {
    [3.5185]
    [3.5237]
    if let Some(plank) = row.planks_mut().first_mut() {
  • replacement in src/main.rs at line 133
    [3.5272][3.5272:5323]()
    if let Some(plank) = row.planks().last_mut() {
    [3.5272]
    [3.5323]
    if let Some(plank) = row.planks_mut().last_mut() {
  • edit in src/main.rs at line 139
    [3.1229][3.644:645](),[3.1583][3.644:645](),[3.644][3.644:645](),[3.1324][3.2867:3259](),[3.3259][3.1442:1459](),[3.1442][3.1442:1459](),[3.1459][3.3260:3334](),[3.3334][3.1862:1878](),[3.1862][3.1862:1878](),[3.1929][3.1923:1925](),[3.1923][3.1923:1925](),[3.1925][3.3335:3375]()
    /*
    for x in 0..plankcount {
    if planklist[x].0 == ROOMLENGTH {
    println!("|{:-^22}|", ROOMLENGTH);
    } else {
    // If x is odd
    if planklist[x].0 == planklist[x].1 {
    println!("|{:-^10}||{:-^10}|", planklist[x].0, planklist[x].1)
    } else if planklist[x].0 < planklist[x].1 {
    println!("|{:-^7}||{:-^13}|", planklist[x].0, planklist[x].1)
    } else {
    println!("|{:-^13}||{:-^7}|", planklist[x].0, planklist[x].1)
    }
    }
    }
    println!();
    println!("Lycka till!");
    */