Assessment reports>Initia>Threat Model>Module string_utils.move

Module string_utils.move

This module implements utility functions that help formatting Move values as strings.

The following functions return a string representation of any object, differing in minor formatting settings:

  • public fun to_string<T>(s: &T): String

  • public fun to_string_with_canonical_addresses<T>(s: &T): String (uses canonical representation for addresses)

  • public fun to_string_with_integer_types<T>(s: &T): String (qualifies integers with a suffix identifying their type, e.g., 8u128)

  • public fun debug_string<T>(s: &T): String (pretty prints the inputs, using indentation and newlines)

Despite Move lacking support for varargs, the module also provides some limited format string support via these functions:

  • public fun format1<T0: drop>(fmt: &vector<u8>, a: T0): String

  • public fun format2<T0: drop, T1: drop>(fmt: &vector<u8>, a: T0, b: T1): String

  • public fun format3<T0: drop, T1: drop, T2: drop>(fmt: &vector<u8>, a: T0, b: T1, c: T2): String

  • public fun format4<T0: drop, T1: drop, T2: drop, T3: drop>(fmt: &vector<u8>, a: T0, b: T1, c: T2, d: T3): String

Zellic © 2024Back to top ↑