Module: ScaleRb::Types
- Included in:
- CodecUtils::InternalDecodeUtils, CodecUtils::InternalEncodeUtils, Decode, Encode, Metadata::Registry, PortableRegistry
- Defined in:
- lib/scale_rb/types.rb
Defined Under Namespace
Classes: ArrayType, Base, BitSequenceType, CompactType, Field, PrimitiveType, SequenceType, SimpleVariant, StructType, StructVariant, TupleType, TupleVariant, UnitType, VariantType
Constant Summary collapse
- Primitive =
Types::Strict::Symbol.enum( :I8, :U8, :I16, :U16, :I32, :U32, :I64, :U64, :I128, :U128, :I256, :U256, :Bool, :Str, :Char )
- Ti =
Types::Strict::Integer | Types::Strict::String
- U8 =
U8 = Types::Strict::Integer.constrained(gteq: 0, lt: 256)
Types::Strict::Integer
- U8Array =
Types::Strict::Array.of(U8)
- Hex =
Types::Strict::String.constrained(format: /\A0x[0-9a-fA-F]+\z/)
- Registry =
Types.Interface(:[])
- HashMap =
lambda do |key_type, value_type| Types::Hash.map(key_type, value_type) end
- UnsignedInteger =
Types::Strict::Integer.constrained(gteq: 0)
- TypedArray =
->(type) { Types::Array.of(type) }
- VariantKind =
Instance(SimpleVariant) | Instance(TupleVariant) | Instance(StructVariant)
- PortableType =
Instance(VariantType) | Instance(StructType) | Instance(TupleType) | Instance(ArrayType) | Instance(CompactType) | Instance(PrimitiveType) | Instance(UnitType) | Instance(SequenceType) | Instance(BitSequenceType)
- DecodeResult =
lambda do |type| Types::Array.of(Types::Any).constrained(size: 2).constructor do |arr| [type[arr[0]], arr[1]] # U8Array[arr[1]], but performance is not good. end end