diff --git a/src/primitive.rs b/src/primitive.rs index 58e1827..c662497 100644 --- a/src/primitive.rs +++ b/src/primitive.rs @@ -50,6 +50,10 @@ pub trait GetOtherEnd>: GetEnds } } +pub trait GetWraparound: GetLayout + GetNodeIndex { + fn wraparound(&self) -> Option; +} + pub trait GetFirstRail: GetLayout + GetNodeIndex { fn first_rail(&self) -> Option { self.layout() @@ -287,6 +291,12 @@ impl<'a> MakeShape for FixedDot<'a> { impl<'a> GetFirstRail for FixedDot<'a> {} +impl<'a> GetWraparound for FixedDot<'a> { + fn wraparound(&self) -> Option { + self.first_rail() + } +} + pub type LooseDot<'a> = GenericPrimitive<'a, LooseDotWeight>; impl_loose_primitive!(LooseDot, LooseDotWeight); @@ -467,6 +477,11 @@ impl<'a> GetEnds for FixedBend<'a> { impl<'a> GetOtherEnd for FixedBend<'a> {} impl<'a> GetFirstRail for FixedBend<'a> {} +impl<'a> GetWraparound for FixedBend<'a> { + fn wraparound(&self) -> Option { + self.first_rail() + } +} impl<'a> GetCore for FixedBend<'a> {} // TODO: Fixed bends don't have cores actually. //impl<'a> GetInnerOuter for FixedBend<'a> {} @@ -537,5 +552,10 @@ impl<'a> GetEnds for LooseBend<'a> { } impl<'a> GetOtherEnd for LooseBend<'a> {} +impl<'a> GetWraparound for LooseBend<'a> { + fn wraparound(&self) -> Option { + self.outer() + } +} impl<'a> GetCore for LooseBend<'a> {} impl<'a> GetInnerOuter for LooseBend<'a> {}