struct Set(T)

Overview

Set implements a collection of unordered values with no duplicates.

An Enumerable object can be converted to Set using the #to_set method.

Set uses Hash as storage, so you must note the following points:

Example

s1 = Set{1, 2}
s2 = [1, 2].to_set
s3 = Set.new [1, 2]
s1 == s2 # => true
s1 == s3 # => true
s1.add(2)
s1.concat([6, 8])
s1.subset_of? s2 # => false
s2.subset_of? s1 # => true

Included Modules

Defined in:

message_pack/to_msgpack.cr

Constructors

Instance Method 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

def self.new(pull : MessagePack::Unpacker) #

[View source]

Instance Method Detail

def to_msgpack(packer : MessagePack::Packer) #

[View source]