Rework wait primitive to condvar
This commit is contained in:
@@ -53,6 +53,16 @@ impl<T> Direction<T> {
|
||||
east: (self.east, other.east),
|
||||
}
|
||||
}
|
||||
|
||||
/// Flips all direction through origo
|
||||
pub fn opposite(self) -> Self {
|
||||
Self {
|
||||
north: self.south,
|
||||
south: self.north,
|
||||
east: self.west,
|
||||
west: self.east,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Direction<Option<T>> {
|
||||
@@ -96,6 +106,15 @@ impl<T> Direction<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Direction<bool> {
|
||||
pub fn all(&self) -> bool {
|
||||
self.north && self.south && self.east && self.west
|
||||
}
|
||||
pub fn any(&self) -> bool {
|
||||
self.north || self.south || self.east || self.west
|
||||
}
|
||||
}
|
||||
|
||||
/// Linearly spaced parameters, apart from the boundaries which
|
||||
/// only have a distance of `h/2` from the boundary
|
||||
pub fn h2linspace(start: Float, end: Float, n: usize) -> ndarray::Array1<Float> {
|
||||
|
||||
Reference in New Issue
Block a user