in src/main/scala/com/twitter/stitch/Stitch.scala [1744:1763]
def ref[T](s: Stitch[T]): Stitch[T] = Ref(s)
/** Makes a thread-safe Stitch with by-reference rather than by-name semantics;
* this is the same as using [[ref]] except that simplification is
* synchronized.
*
* This makes it thread-safe to re-use across calls to [[Stitch.run]] calls
*/
def synchronizedRef[T](s: Stitch[T]): Stitch[T] = new SynchronizedRef(s)
/** helper for determining if a Stitch is completed to avoid doing extra work when we know its already done */
private[stitch] object CompletedStitch {
def unapply[T](s: Stitch[T]): Option[Const[T]] =
s match {
case const: Const[T] => Some(const)
case Ref(const: Const[T]) => Some(const)
case SynchronizedRef(const: Const[T]) => Some(const)
case _ => scala.None
}
}