commit 845a983592e536ec2393eabd5e955ccc4189ed2b
parent 94598bedf5e87bc78fdc416adbc6c94eedaa981c
Author: kernelkind <kernelkind@gmail.com>
Date: Thu, 5 Dec 2024 20:01:27 -0500
new column constructor
Signed-off-by: kernelkind <kernelkind@gmail.com>
Diffstat:
1 file changed, 23 insertions(+), 0 deletions(-)
diff --git a/src/column.rs b/src/column.rs
@@ -90,6 +90,24 @@ impl Columns {
)]));
}
+ pub fn insert_intermediary_routes(&mut self, intermediary_routes: Vec<IntermediaryRoute>) {
+ let id = Self::get_new_id();
+
+ let routes = intermediary_routes
+ .into_iter()
+ .map(|r| match r {
+ IntermediaryRoute::Timeline(timeline) => {
+ let route = Route::timeline(timeline.id);
+ self.timelines.insert(id, timeline);
+ route
+ }
+ IntermediaryRoute::Route(route) => route,
+ })
+ .collect();
+
+ self.columns.insert(id, Column::new(routes));
+ }
+
fn get_new_id() -> u32 {
UIDS.fetch_add(1, Ordering::Relaxed)
}
@@ -270,3 +288,8 @@ impl SerializableColumns {
columns
}
}
+
+pub enum IntermediaryRoute {
+ Timeline(Timeline),
+ Route(Route),
+}