()
| 43 | } |
| 44 | |
| 45 | fn main() -> eyre::Result<()> { |
| 46 | color_eyre::install()?; |
| 47 | let args = CmdlineOptions::parse(); |
| 48 | |
| 49 | let filter = tracing_subscriber::EnvFilter::builder() |
| 50 | .with_default_directive(args.log_level.into()) |
| 51 | .from_env_lossy(); |
| 52 | tracing_subscriber::fmt() |
| 53 | .with_env_filter(filter) |
| 54 | .with_ansi(true) |
| 55 | .with_writer(std::io::stderr) |
| 56 | .init(); |
| 57 | |
| 58 | let reader = get_input_reader(&args.input)?; |
| 59 | let mut writer = get_output_writer(&args.output)?; |
| 60 | let geometries = read_geometries(reader); // lazily loaded |
| 61 | |
| 62 | match args.strategy { |
| 63 | TriangulationStrategy::EachGeometry => { |
| 64 | let triangulations = geometries |
| 65 | .map(|geom| flatten_geometries_into_points(std::iter::once(geom))) |
| 66 | .filter_map(triangulate); |
| 67 | for triangulation in triangulations { |
| 68 | let graph = triangulation.graph(); |
| 69 | write_graph(&mut writer, &graph, &args.output_format)?; |
| 70 | } |
| 71 | } |
| 72 | TriangulationStrategy::WholeCollection => { |
| 73 | let points = flatten_geometries_into_points(geometries); |
| 74 | if let Some(triangulation) = triangulate(points) { |
| 75 | let graph = triangulation.graph(); |
| 76 | write_graph(writer, &graph, &args.output_format)?; |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | Ok(()) |
| 82 | } |
nothing calls this directly
no test coverage detected