Struct neweden::ExtendedUniverse
source · pub struct ExtendedUniverse<'a, U> { /* private fields */ }
Expand description
Extends the universe with dynamic connections. This is intended to be used to allow pathfinding through wormholes and titan bridges.
Example
use std::env;
use neweden::source::sqlite::DatabaseBuilder;
use neweden::navigation::PathBuilder;
use neweden::Navigatable;
use neweden::{Connection, ConnectionType, WormholeType};
let uri = std::env::var("SQLITE_URI").unwrap();
let wormholes = vec![Connection {
from: 30002718.into(), // Rancer
to: 30000049.into(), // Camal
type_: ConnectionType::Wormhole(WormholeType::VeryLarge),
}];
let universe = DatabaseBuilder::new(&uri).build().unwrap();
let extended = universe.extend(wormholes.into()); // make into an adjacent map and pass into extend()
let path = PathBuilder::new(&extended)
.waypoint(extended.get_system(&30002718.into()).unwrap()) // from Rancer
.waypoint(extended.get_system(&30000049.into()).unwrap()) // to Camal
.build() // returns an iterator
.collect::<Vec<_>>();
assert_eq!(2, path.len()); // direct jump through our wormhole
Implementations§
source§impl<'a, U: Galaxy + Navigatable> ExtendedUniverse<'a, U>
impl<'a, U: Galaxy + Navigatable> ExtendedUniverse<'a, U>
pub fn new(universe: &'a U, connections: AdjacentMap) -> Self
Trait Implementations§
source§impl<'a, U: Debug> Debug for ExtendedUniverse<'a, U>
impl<'a, U: Debug> Debug for ExtendedUniverse<'a, U>
source§impl<'a, U: Galaxy> Galaxy for ExtendedUniverse<'a, U>
impl<'a, U: Galaxy> Galaxy for ExtendedUniverse<'a, U>
Auto Trait Implementations§
impl<'a, U> RefUnwindSafe for ExtendedUniverse<'a, U>where U: RefUnwindSafe,
impl<'a, U> Send for ExtendedUniverse<'a, U>where U: Sync,
impl<'a, U> Sync for ExtendedUniverse<'a, U>where U: Sync,
impl<'a, U> Unpin for ExtendedUniverse<'a, U>
impl<'a, U> UnwindSafe for ExtendedUniverse<'a, U>where U: RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more