struct MessagePack::Any
- MessagePack::Any
- Struct
- Value
- Object
Overview
A wrapper around a MessagePack object with convenience methods for type conversions
Defined in:
message_pack/any.crmessage_pack/to_msgpack.cr
Constructors
Instance Method Summary
-
#==(arg)
Returns
true
if this struct is equal to other. - #[](key : Symbol) : Any
- #[](key : Type) : Any
- #[]?(key : Type) : Any | Nil
-
#as_a : Array(MessagePack::Type)
Convert to Array(MessagePack::Type)
-
#as_a? : Array(MessagePack::Type) | Nil
Maybe convert to Array(MessagePack::Type)?
-
#as_bool : Bool
Convert to Bool
-
#as_bool? : Bool | Nil
Maybe convert to Bool?
-
#as_f : Float64
Convert to Float64
-
#as_f? : Float64 | Nil
Maybe convert to Float64?
-
#as_h : Hash(MessagePack::Type, MessagePack::Type)
Convert to Hash(MessagePack::Type, MessagePack::Type)
-
#as_h? : Hash(MessagePack::Type, MessagePack::Type) | Nil
Maybe convert to Hash(MessagePack::Type, MessagePack::Type)?
- #as_i
-
#as_i16 : Int16
Convert to Int16
-
#as_i16? : Int16 | Nil
Maybe convert to Int16?
-
#as_i32 : Int32
Convert to Int32
-
#as_i32? : Int32 | Nil
Maybe convert to Int32?
-
#as_i64 : Int64
Convert to Int64
-
#as_i64? : Int64 | Nil
Maybe convert to Int64?
-
#as_i8 : Int8
Convert to Int8
-
#as_i8? : Int8 | Nil
Maybe convert to Int8?
- #as_i?
-
#as_nil : Nil
Convert to Nil
-
#as_nil? : Nil | Nil
Maybe convert to Nil?
-
#as_s : String
Convert to String
-
#as_s? : String | Nil
Maybe convert to String?
- #as_u
-
#as_u16 : UInt16
Convert to UInt16
-
#as_u16? : UInt16 | Nil
Maybe convert to UInt16?
-
#as_u32 : UInt32
Convert to UInt32
-
#as_u32? : UInt32 | Nil
Maybe convert to UInt32?
-
#as_u64 : UInt64
Convert to UInt64
-
#as_u64? : UInt64 | Nil
Maybe convert to UInt64?
-
#as_u8 : UInt8
Convert to UInt8
-
#as_u8? : UInt8 | Nil
Maybe convert to UInt8?
- #as_u?
- #clone
- #dig(key : Type)
- #dig(key : Type, *subkeys)
- #dig?(key : Type, *subkeys)
-
#dup
Returns a shallow copy of this object.
- #each(&)
- #inspect(*args, **options)
- #inspect(*args, **options, &)
- #raw : Type
- #size
- #to_msgpack(packer : MessagePack::Packer)
- #to_s(*args, **options)
- #to_s(*args, **options, &)
Macro Summary
Instance methods inherited from class Object
===(other : MessagePack::Any)
===,
to_msgpack(io : IO)to_msgpack(packer : MessagePack::Packer)
to_msgpack to_msgpack
Class methods inherited from class Object
from_msgpack(string_or_io, zero_copy = false)
from_msgpack
Constructor Detail
Instance Method Detail
Returns true
if this struct is equal to other.
Both structs' instance vars are compared to each other. Thus, two structs are considered equal if each of their instance variables are equal. Subclasses should override this method to provide specific equality semantics.
struct Point
def initialize(@x : Int32, @y : Int32)
end
end
p1 = Point.new 1, 2
p2 = Point.new 1, 2
p3 = Point.new 3, 4
p1 == p2 # => true
p1 == p3 # => false
Maybe convert to Array(MessagePack::Type)?
Convert to Hash(MessagePack::Type, MessagePack::Type)
Maybe convert to Hash(MessagePack::Type, MessagePack::Type)?
Returns a shallow copy of this object.
Because Value
is a value type, this method returns self
,
which already involves a shallow copy of this object because
value types are passed by value.