Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • intin SCALE integers can be encoded as fixed-width integer and compact integer. Compact integer itself has 4 modes. So generally we have 5 ways to serde integer (1 fixed-width + 4 modes of compact integers) 

    Code Block
    languagebash
    {
    	"type": "int",
    	"mode": "CompactTwoByte" //possible values FixedWidth, CompactSingleByte, CompactTwoByte, CompactFourByte, CompactBigInteger,
    }


  • bool: no tricks here 

    {


    Code Block
    languagebash
    {
    	"type": "bool"

    
    }


2. Built-in containers 

  • [Option / Result / Vec / typle : basically we are interested in only inner values of the container


    Code Block
    languagebash
    [

    {
    
    {
        "type": "Option",

    
        "item_type":
    {
     {
            "type" : "bool"

    }
    
        }
    
    },

    {
    
    {
        "type": "Result",

    
        "item_type":
    {
     {
            "type": "int",

    
            "mode": "CompactFourByte"

    }
    
        }
    },

    {
    
    {
        "type": "Vec
    ",
    ",
        "item_type": {
            "type": "bool"
        }
    },
    {
        "type": "tuple",
        "items": [
            {
                "type": "int",
                "mode": "CompactFourByte"
            },
            {
                "type": "Option",
                "item_type":
    {
     {
                    "type" : "bool"

    }
    }
    
                }
            
            }
        ]
    }
    ]


3. Custom containers 

  • Structures

...