struct

Trait

Inherits Struct < Value < Object

Constructors

new(base : TraitDef, type_args : Slice(Type) = ::Slice(Type).empty)
Source
new(base : TraitDef, type_arg : Type)

def self.unknown(name : String, type_args : ::Slice(Type) = ::Slice(Type).empty) Trait .new(TraitDef.new(Location.zero, Mode::Let, name)) .with_type_args(type_args) end

Source

Instance methods

base
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
mode
Source
substitute(rule : Slice(Type)) : Trait
Source
to_s(io : IO)

Same as #inspect(io).

Source
type_args
Source