1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
//! Metro is a crate for creating and rendering graphs //! similar to `git log --graph`. //! //! # Example Output //! //! *The code for creating the following example, can be found //! after the graph.* //! //! ```text //! * Station 1 //! * Station 2 //! * Station 3 //! |\ //! | * Station 4 //! | |\ //! | * | Station 5 //! | | * Station 6 //! * | | Station 7 //! | * | Station 8 //! | | * Station 9 //! | | |\ //! | | | |\ //! | | | | | Station 10 (Detached) //! | |_|_|/ //! |/| | | //! | | | * Station 11 //! | " | | //! | / / //! * | | Station 12 //! | * | Station 13 //! | | * Station 14 //! | |/ //! |/| //! | * Station 15 //! | " //! * Station 16 //! ``` //! //! # Example Using `Metro` //! //! *The following example outputs the graph above.* //! //! ```no_run //! use metro::Metro; //! //! let mut metro = Metro::new(); //! //! let mut track1 = metro.new_track(); //! track1.add_station("Station 1"); //! track1.add_station("Station 2"); //! track1.add_station("Station 3"); //! //! let mut track2 = track1.split(); //! track2.add_station("Station 4"); //! //! let mut track3 = track2.split(); //! track2.add_station("Station 5"); //! track3.add_station("Station 6"); //! //! track1.add_station("Station 7"); //! track2.add_station("Station 8"); //! track3.add_station("Station 9"); //! //! let mut track4 = track3.split(); //! let track5 = track4.split(); //! //! metro.add_station("Station 10 (Detached)"); //! //! track5.join(&track1); //! //! track4.add_station("Station 11"); //! //! track2.stop(); //! //! track1.add_station("Station 12"); //! track3.add_station("Station 13"); //! track4.add_station("Station 14"); //! //! track4.join(&track1); //! //! track3.add_station("Station 15"); //! //! track3.stop(); //! //! track1.add_station("Station 16"); //! //! let string = metro.to_string().unwrap(); //! //! println!("{}", string); //! ``` //! //! # Example Using `Event` //! //! *The following example outputs the graph above.* //! //! ```no_run //! use metro::Event::*; //! //! let events = [ //! Station(0, "Station 1"), //! Station(0, "Station 2"), //! Station(0, "Station 3"), //! SplitTrack(0, 1), //! Station(1, "Station 4"), //! SplitTrack(1, 2), //! Station(1, "Station 5"), //! Station(2, "Station 6"), //! Station(0, "Station 7"), //! Station(1, "Station 8"), //! Station(2, "Station 9"), //! SplitTrack(2, 3), //! SplitTrack(3, 4), //! Station(5, "Station 10 (Detached)"), //! JoinTrack(4, 0), //! Station(3, "Station 11"), //! StopTrack(1), //! Station(0, "Station 12"), //! Station(2, "Station 13"), //! Station(3, "Station 14"), //! JoinTrack(3, 0), //! Station(2, "Station 15"), //! StopTrack(2), //! Station(0, "Station 16"), //! ]; //! //! let string = metro::to_string(&events).unwrap(); //! //! println!("{}", string); //! ``` #![forbid(unsafe_code)] #![deny(missing_docs)] // #![deny(missing_doc_code_examples)] #![deny(missing_debug_implementations)] #![warn(clippy::all)] mod events; mod metro; pub use crate::metro::{Metro, Track}; pub use events::*;