struct

Type

Inherits Struct < Value < Object

Constructors

array(t : Type) : Type
Source
bool
Source
byte
Source
float
Source
never
Source
string
Source

Class methods

adt(base : TypeDefinition, type_args : ::Slice(Type) = ::Slice(Type).empty)
Source
array=(arr : StructDef)
Source
function(*args)
Source
pointer(type)
Source
slice(type)
Source
string=(str : Type)
Source
trait(*args)
Source
tuple(*args)
Source
union(one_type : Type)
Source
union(types : Iterator(Type))
Source
unknown(name, type_args = ::Slice(Type).empty)
Source
var(index : Int32, ctx : TypeContext)
Source
var(type_parameter : TypeParameter)
Source

Instance methods

base_or_class
Source
collect_type_vars(subs : Array(Type))
Source
copy_type?
Source
generic?
Source
get_field?(field_name : String) : Field | ::Nil
Source
initialize
Source
inspect(io : IO)

Appends this struct's name and instance variables names and values to the given IO.

struct Point
  def initialize(@x : Int32, @y : Int32)
  end
end

p1 = Point.new 1, 2
p1.to_s    # "Point(@x=1, @y=2)"
p1.inspect # "Point(@x=1, @y=2)"
Source
is_enum?
Source
is_struct?
Source
mode
Source
primitive?
Source
substitute(type_args : ::Slice(Type)) : Type
Source
to_s(io : IO)

Same as #inspect(io).

Source
type_args?
Source
type_def?
Source

Macros

primitive
Source

Nested types