SHARE
TWEET

Untitled

tinyevil Dec 8th, 2018 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. adt Twine{
  2.     Null
  3.     CStr(cstr:ptr u8)
  4.     StringView(view:string_view)
  5.     Twine(lhs rhs:ref Twine)
  6.    
  7.     method length(self:ref Twine):uword{
  8.         switch(self){
  9.         case Null: return 0;
  10.         case CStr(cstr): return strlen(cstr);
  11.         case StringView(view): return view.size();
  12.         case Twine(lhs, rhs): return lhs.length() + rhs.length();
  13.         }
  14.     }
  15.    
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top