From ea4410cdb53da1663398376c603e56096c6d81a7 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 25 Mar 2022 18:09:39 +0000 Subject: [PATCH] builtin: document the rune.length_in_bytes method (#13826) --- vlib/builtin/rune.v | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vlib/builtin/rune.v b/vlib/builtin/rune.v index eaa893e363..9d50b22cdd 100644 --- a/vlib/builtin/rune.v +++ b/vlib/builtin/rune.v @@ -61,6 +61,8 @@ pub fn (c rune) bytes() []byte { return res } +// length_in_bytes returns the number of bytes needed to store the code point. +// Returns -1 if the data is not a valid code point. pub fn (c rune) length_in_bytes() int { code := u32(c) if code <= 0x7F {