12 // Set creates a set type with the given element Type.
14 // Set types are CollectionType implementations.
15 func Set(elem Type) Type {
23 // Equals returns true if the other Type is a set whose element type is
24 // equal to that of the receiver.
25 func (t typeSet) Equals(other Type) bool {
26 ot, isSet := other.typeImpl.(typeSet)
31 return t.ElementTypeT.Equals(ot.ElementTypeT)
34 func (t typeSet) FriendlyName() string {
35 return "set of " + t.ElementTypeT.FriendlyName()
38 func (t typeSet) ElementType() Type {
42 func (t typeSet) GoString() string {
43 return fmt.Sprintf("cty.Set(%#v)", t.ElementTypeT)
46 // IsSetType returns true if the given type is a list type, regardless of its
48 func (t Type) IsSetType() bool {
49 _, ok := t.typeImpl.(typeSet)
53 // SetElementType is a convenience method that checks if the given type is
54 // a set type, returning a pointer to its element type if so and nil
55 // otherwise. This is intended to allow convenient conditional branches,
58 // if et := t.SetElementType(); et != nil {
59 // // Do something with *et
61 func (t Type) SetElementType() *Type {
62 if lt, ok := t.typeImpl.(typeSet); ok {
63 return <.ElementTypeT