From 6a11f73eb368f2e74997a472a4974635d1af8e05 Mon Sep 17 00:00:00 2001 From: mertcandav Date: Fri, 17 Jan 2025 15:14:26 +0300 Subject: [PATCH] std/encoding/json: refactor documentation --- std/encoding/json/decode.jule | 60 ++++++++++++++++----------------- std/encoding/json/encode.jule | 62 +++++++++++++++++------------------ 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/std/encoding/json/decode.jule b/std/encoding/json/decode.jule index 60dafb7ed..400e362f6 100644 --- a/std/encoding/json/decode.jule +++ b/std/encoding/json/decode.jule @@ -625,44 +625,44 @@ impl jsonDecoder { // Implementation supports only Jule types, excluding binded types. // // Decoding details: -// Since this function designed for comptime type analysis, the type [T] should -// be valid type for comptime. The type [any], which is stores dynamic type, is not valid. -// Any unsupported type causes exceptional with [DecodeError.UnsupportedType]. -// Any incompatible value for type, invalid literal or something else causes -// exceptional with [DecodeError.UnsupportedType]. +// Since this function designed for comptime type analysis, the type [T] should +// be valid type for comptime. The type [any], which is stores dynamic type, is not valid. +// Any unsupported type causes exceptional with [DecodeError.UnsupportedType]. +// Any incompatible value for type, invalid literal or something else causes +// exceptional with [DecodeError.UnsupportedType]. // -// Signed/Unsigned Integers, Floating-Points: -// Decode as JSON numbers. +// Signed/Unsigned Integers, Floating-Points: +// Decode as JSON numbers. // -// Booleans: -// Decode as JSON booleans. +// Booleans: +// Decode as JSON booleans. // -// Strings: -// Decode as JSON strings. Invalid UTF-8 or invalid UTF-16 surrogate pairs -// are not treated as an exception. Instead, they are replaced by the -// Unicode replacement character U+FFFD. +// Strings: +// Decode as JSON strings. Invalid UTF-8 or invalid UTF-16 surrogate pairs +// are not treated as an exception. Instead, they are replaced by the +// Unicode replacement character U+FFFD. // -// Structs: -// Decode as JSON objects with only public fields of struct. +// Structs: +// Decode as JSON objects with only public fields of struct. // -// Arrays: -// Decode as JSON array. -// If array size is larger than JSON array, algorithm will change the -// remain data to zero-value for data-type. +// Arrays: +// Decode as JSON array. +// If array size is larger than JSON array, algorithm will change the +// remain data to zero-value for data-type. // -// Slices: -// Decode as JSON array. -// For the []byte type, decodes strings as a base64-encoded string if the input -// is string, otherwise decodes as JSON array. +// Slices: +// Decode as JSON array. +// For the []byte type, decodes strings as a base64-encoded string if the input +// is string, otherwise decodes as JSON array. // -// Maps: -// Decode as JSON object. -// Map's key type only can be: signed integer, unsigned integer and string. -// Other types will cause exceptional with [DecodeError.UnsupportedType]. +// Maps: +// Decode as JSON object. +// Map's key type only can be: signed integer, unsigned integer and string. +// Other types will cause exceptional with [DecodeError.UnsupportedType]. // -// Smart Pointers: -// If smart pointer is nil, will be allocated by the algorithm for decoding. -// Otherwise, will decode into dereferenced value. +// Smart Pointers: +// If smart pointer is nil, will be allocated by the algorithm for decoding. +// Otherwise, will decode into dereferenced value. // // Too many nested types are not specifically checked and may cause too many // recursive function calls, resulting in a crash at runtime. As a result of the tests, diff --git a/std/encoding/json/encode.jule b/std/encoding/json/encode.jule index 994bb05e9..cb2e1a8ce 100644 --- a/std/encoding/json/encode.jule +++ b/std/encoding/json/encode.jule @@ -447,45 +447,45 @@ fn encoder(): jsonEncoder { // Implementation supports only Jule types, excluding binded types. // // Encoding details: -// Since this function designed for comptime type analysis, the type [T] should -// be valid type for comptime. The type [any], which is stores dynamic type, is not valid. -// Any unsupported type causes exceptional with [EncodeError.UnsupportedType]. +// Since this function designed for comptime type analysis, the type [T] should +// be valid type for comptime. The type [any], which is stores dynamic type, is not valid. +// Any unsupported type causes exceptional with [EncodeError.UnsupportedType]. // -// Signed/Unsigned Integers, Floating-Points: -// Encode as JSON numbers. -// For floating-points, NaN or ±Inf will cause exceptional with [EncodeError.UnsupportedFloatValue]. +// Signed/Unsigned Integers, Floating-Points: +// Encode as JSON numbers. +// For floating-points, NaN or ±Inf will cause exceptional with [EncodeError.UnsupportedFloatValue]. // -// Booleans: -// Encode as JSON booleans. +// Booleans: +// Encode as JSON booleans. // -// Strings: -// Encode as JSON strings coerced to valid UTF-8, replacing invalid bytes -// with the Unicode replacement rune. So that the JSON will be safe to embed -// inside HTML