TypeMap

kyo.TypeMap$package.TypeMap
object TypeMap

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
TypeMap.type

Members list

Value members

Concrete methods

def apply[A](a: A)(using ta: Tag[A]): TypeMap[A]

Creates a TypeMap with a single key-value pair.

Creates a TypeMap with a single key-value pair.

Type parameters

A

The type of the value

Value parameters

a

The value to add

ta

An implicit Tag for type A

Attributes

Returns

A new TypeMap with the single key-value pair

def apply[A, B](a: A, b: B)(using ta: Tag[A], tb: Tag[B]): TypeMap[A & B]

Creates a TypeMap with two key-value pairs.

Creates a TypeMap with two key-value pairs.

Type parameters

A

The type of the first value

B

The type of the second value

Value parameters

a

The first value to add

b

The second value to add

ta

An implicit Tag for type A

tb

An implicit Tag for type B

Attributes

Returns

A new TypeMap with the two key-value pairs

def apply[A : Tag, B : Tag, C : Tag](a: A, b: B, c: C)(implicit evidence$1: Tag[A], evidence$2: Tag[B], evidence$3: Tag[C], ta: Tag[A], tb: Tag[B], tc: Tag[C]): TypeMap[A & B & C]

Creates a TypeMap with three key-value pairs.

Creates a TypeMap with three key-value pairs.

Attributes

def apply[A : Tag, B : Tag, C : Tag, D : Tag](a: A, b: B, c: C, d: D)(implicit evidence$1: Tag[A], evidence$2: Tag[B], evidence$3: Tag[C], evidence$4: Tag[D], ta: Tag[A], tb: Tag[B], tc: Tag[C], td: Tag[D]): TypeMap[A & B & C & D]

Creates a TypeMap with four key-value pairs.

Creates a TypeMap with four key-value pairs.

Attributes

Concrete fields

val empty: TypeMap[Any]

An empty TypeMap.

An empty TypeMap.

Attributes

Extensions

Extensions

extension [A](self: TypeMap[A])
inline def add[B](b: B)(using inline t: Tag[B]): TypeMap[A & B]

Adds a new key-value pair to the TypeMap.

Adds a new key-value pair to the TypeMap.

Type parameters

B

The type of the value to add

Value parameters

b

The value to add

t

An implicit Tag for type B

Attributes

Returns

A new TypeMap with the added key-value pair

def get[B >: A](using t: Tag[B]): B

Retrieves a value of type B from the TypeMap.

Retrieves a value of type B from the TypeMap.

Type parameters

B

The type of the value to retrieve (must be a supertype of A)

Value parameters

t

An implicit Tag for type B

Attributes

Returns

The value of type B

Throws
RuntimeException

if the value is not found

inline def isEmpty: Boolean

Checks if the TypeMap is empty.

Checks if the TypeMap is empty.

Attributes

Returns

true if the TypeMap is empty, false otherwise

def prune[B >: A](using t: Tag[B]): TypeMap[B]

Filters the TypeMap to only include key-value pairs where the key is a subtype of the given type.

Filters the TypeMap to only include key-value pairs where the key is a subtype of the given type.

Type parameters

B

The type to filter by (must be a supertype of A)

Value parameters

t

An implicit Tag for type B

Attributes

Returns

A new TypeMap containing only the filtered key-value pairs

def show: String

Returns a string representation of the TypeMap.

Returns a string representation of the TypeMap.

Attributes

Returns

A string describing the contents of the TypeMap

inline def size: Int

Returns the number of key-value pairs in the TypeMap.

Returns the number of key-value pairs in the TypeMap.

Attributes

Returns

The size of the TypeMap

inline def union[B](that: TypeMap[B]): TypeMap[A & B]

Combines this TypeMap with another TypeMap.

Combines this TypeMap with another TypeMap.

Type parameters

B

The type of values in the other TypeMap

Value parameters

that

The TypeMap to combine with

Attributes

Returns

A new TypeMap containing all key-value pairs from both TypeMaps