Advertisement
tinyevil

Untitled

Dec 8th, 2018
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement