mirror of
https://github.com/threefoldtech/mycelium.git
synced 2026-10-23 06:01:16 +00:00
Add method to get selected route from RouteList
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
1 parent
3d0b518794
commit
09d2eaa2e0
1 file changed
+8
@@ -173,6 +173,14 @@ impl RouteList {
|
||||
.map(|(_, e)| e)
|
||||
.find(|entry| entry.neighbour == route_key.neighbour)
|
||||
}
|
||||
|
||||
/// Returns the selected route for the [`Subnet`] this is the `RouteList` for, if one exists.
|
||||
pub fn selected(&self) -> Option<&RouteEntry> {
|
||||
self.list
|
||||
.get(0)
|
||||
.map(|(_, re)| re)
|
||||
.and_then(|re| if re.selected { Some(re) } else { None })
|
||||
}
|
||||
}
|
||||
|
||||
/// A guard which allows write access to a single [`RouteEntry`].
|
||||
|
||||
Reference in new issue
Block a user