Guest User

Untitled

a guest
Oct 23rd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. package shipreq.webapp.base.protocol
  2.  
  3. import boopickle._
  4.  
  5. object BinCodecGeneric extends BasicImplicitPicklers with TuplePicklers {
  6.  
  7. @inline implicit class PicklerExt[A](private val p: Pickler[A]) extends AnyVal {
  8.  
  9. // ...
  10.  
  11. /** Unpickling is safe but pickling will break if you pass it b⊄A */
  12. @inline def unsafeWiden[B >: A]: Pickler[B] =
  13. // new Pickler[B] {
  14. // override def pickle(b: B)(implicit state: PickleState): Unit = p.pickle(b.asInstanceOf[A])
  15. // override def unpickle(implicit state: UnpickleState) : A = p.unpickle
  16. // }
  17. p.asInstanceOf[Pickler[B]]
  18. }
  19.  
  20. // ...
  21. }
Add Comment
Please, Sign In to add comment