docs: put some more dots in the doc comments of public APIs, found by find_doc_comments_with_no_dots.v

This commit is contained in:
Delyan Angelov 2025-07-02 16:12:03 +03:00
parent 3271c728d5
commit 30ce22866d
6 changed files with 13 additions and 12 deletions

View file

@ -107,7 +107,7 @@ fn C.cJSON_free(voidptr)
// //
// version returns the version of cJSON as a string // version returns the version of cJSON as a string.
pub fn version() string { pub fn version() string {
return unsafe { tos3(&char(C.cJSON_Version())) } return unsafe { tos3(&char(C.cJSON_Version())) }
} }

View file

@ -436,8 +436,8 @@ pub fn (f []Any) str() string {
return Any(f).json_str() return Any(f).json_str()
} }
// str returns the string representation of the `Any` type. Use the `json_str` method // str returns the string representation of the `Any` type. Use the `json_str` method.
// if you want to use the escaped str() version of the `Any` type. // If you want to use the escaped str() version of the `Any` type.
pub fn (f Any) str() string { pub fn (f Any) str() string {
if f is string { if f is string {
return f return f

View file

@ -326,7 +326,7 @@ pub fn (f Any) to_time() !time.Time {
} }
} }
// map_from convert a struct to map of Any // map_from converts a struct to a map of Any.
pub fn map_from[T](t T) map[string]Any { pub fn map_from[T](t T) map[string]Any {
mut m := map[string]Any{} mut m := map[string]Any{}
$if T is $struct { $if T is $struct {

View file

@ -37,7 +37,7 @@ pub struct Token {
col int // the column in the source where the token occurred col int // the column in the source where the token occurred
} }
// full_col returns the full column information which includes the length // full_col returns the full column information which includes the length.
pub fn (t Token) full_col() int { pub fn (t Token) full_col() int {
return t.col + t.lit.len return t.col + t.lit.len
} }

View file

@ -21,7 +21,7 @@ pub:
superfluous []string superfluous []string
} }
// strict_check // strict_check .
pub fn strict_check[T](json_data string) StructCheckResult { pub fn strict_check[T](json_data string) StructCheckResult {
// REVIEW how performatic is it? // REVIEW how performatic is it?
$if T is $struct { $if T is $struct {
@ -112,7 +112,7 @@ fn get_keys_from_[T]() []string {
return struct_keys return struct_keys
} }
// get_keys_from_json // get_keys_from_json .
pub fn get_keys_from_json(tokens []string) []KeyStruct { pub fn get_keys_from_json(tokens []string) []KeyStruct {
mut key_structs := []KeyStruct{} mut key_structs := []KeyStruct{}

View file

@ -2,7 +2,7 @@ module json2
import time import time
// `Any` is a sum type that lists the possible types to be decoded and used. // Any is a sum type that lists the possible types to be decoded and used.
// `Any` priority order for numbers: floats -> signed integers -> unsigned integers // `Any` priority order for numbers: floats -> signed integers -> unsigned integers
// `Any` priority order for strings: string -> time.Time // `Any` priority order for strings: string -> time.Time
pub type Any = []Any pub type Any = []Any
@ -23,21 +23,22 @@ pub type Any = []Any
| u8 | u8
| Null | Null
// Decodable is an interface, that allows custom implementations for decoding structs from JSON encoded values // Decodable is an interface, that allows custom implementations for decoding structs from JSON encoded values.
pub interface Decodable { pub interface Decodable {
from_json(f Any) from_json(f Any)
} }
// Decodable is an interface, that allows custom implementations for encoding structs to their string based JSON representations // Encodable is an interface, that allows custom implementations for encoding structs to their string based JSON representations.
pub interface Encodable { pub interface Encodable {
json_str() string json_str() string
} }
// `Null` struct is a simple representation of the `null` value in JSON. // Null is a simple representation of the `null` value in JSON.
pub struct Null { pub struct Null {
is_null bool = true is_null bool = true
} }
// null is an instance of the Null type, to ease comparisons with it.
pub const null = Null{} pub const null = Null{}
// ValueKind enumerates the kinds of possible values of the Any sumtype. // ValueKind enumerates the kinds of possible values of the Any sumtype.
@ -49,7 +50,7 @@ pub enum ValueKind {
number number
} }
// str returns the string representation of the specific ValueKind // str returns the string representation of the specific ValueKind.
pub fn (k ValueKind) str() string { pub fn (k ValueKind) str() string {
return match k { return match k {
.unknown { 'unknown' } .unknown { 'unknown' }