Skip to content

Commit bdd1751

Browse files
committed
fern_sim: Updated.
1 parent 002cb75 commit bdd1751

File tree

12 files changed

+69
-27
lines changed

12 files changed

+69
-27
lines changed

fern_sim/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "fern_sim"
33
version = "0.1.0"
4+
edition = "2018"
45
authors = ["You <you@example.com>"]
56
license = "MIT"
67
homepage = "https://fernsim.example.com/"

fern_sim/src/cells.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

fern_sim/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
//! Simulate the growth of ferns, from the level of
22
//! individual cells on up.
33
4-
pub mod cells;
4+
#![warn(rust_2018_idioms)]
5+
#![allow(elided_lifetimes_in_paths)]
6+
57
pub mod plant_structures;
68
pub mod simulation;
79
pub mod spores;

fern_sim/src/plant_structures/leaves.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
//! Simulation of individual leaves (for the formation of leaves, see `stem`).
33
44
pub struct Leaf {
5-
x: bool
5+
pub x: bool
66
}

fern_sim/src/plant_structures/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,17 @@ impl Fern {
4343
self.stems.iter().all(|s| !s.furled)
4444
}
4545
}
46+
47+
/// Create and return a [`VascularPath`] which represents the path of
48+
/// nutrients from the given [`Root`][r] to the given [`Leaf`](leaves::Leaf).
49+
///
50+
/// [r]: roots::Root
51+
pub fn trace_path(leaf: &leaves::Leaf, root: &roots::Root) -> VascularPath {
52+
VascularPath { from: leaf.x, to: root.x }
53+
}
54+
55+
#[doc(alias = "route")]
56+
pub struct VascularPath {
57+
pub from: bool,
58+
pub to: bool,
59+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(dead_code)]
22

33
pub struct Root {
4-
x: bool
4+
pub x: bool
55
}
66

77
pub type RootSet = Vec<Root>;

fern_sim/src/plant_structures/stems.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
//! the feathery leaf structure that's the most immediately recognizable
44
//! property of ferns.
55
6+
// in plant_structures/stems.rs
7+
pub mod xylem;
8+
pub mod phloem;
9+
610
pub struct Stem {
711
pub furled: bool
812
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//! Structures for distributing the products of photosynthesis.
2+
3+
/// Tissue for translocating sucrose and other photosynthesis products.
4+
pub struct Phloem {
5+
pub flow_rate: f32,
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//! Structures for bringing nutrients from roots up to other parts of the plant.
2+
3+
/// Vascular tissue for transporting water and nutrients from the roots.
4+
pub struct Xylem {
5+
pub flow_rate: f32,
6+
}

fern_sim/src/simulation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use std::fs::File;
66
use std::time::Duration;
7-
use plant_structures::{Fern, FernType};
7+
use crate::plant_structures::{Fern, FernType};
88

99
/// The simulated universe.
1010
pub struct Terrarium {

0 commit comments

Comments
 (0)