struct Tessell::UI::UiKey

Overview

Stable non-string key: (parent, local). Derivation mixes identity so that (same parent, diff local) and (diff parent, same local) never collide.

Defined in:

tessell/ui/key.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(parent : UInt64, local : UInt64) #

[View source]
def self.root : UiKey #

[View source]

Instance Method Detail

def ==(other : UiKey) : Bool #

[View source]
def ==(other) : Bool #
Description copied from struct Struct

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

[View source]
def child(local : UInt64) : UiKey #

Derive a child key: mix this key's identity with the child's local id. FNV-1a 64-bit mix over the pair (combined self, local) for stable spread.


[View source]
def hash(hasher) #
Description copied from struct Struct

See Object#hash(hasher)


[View source]
def id64 : UInt64 #

Stable 64-bit identity of this key (for Node id derivation / maps).


[View source]
def local : UInt64 #

[View source]
def parent : UInt64 #

[View source]