scalqa.val.lookup.stable.__.scala Maven / Gradle / Ivy
package scalqa; package `val`; package lookup; import language.implicitConversions
/**
* Stable is an immutable lookup collection
*/
abstract class Stable[A,B] private[scalqa]() extends Lookup[A,B]:
type THIS_TYPE <: Stable[A,B]
/**
* Join key/value association
*
* Creates a new [[Stable]] with given key/value joined
*/
def join(key: A, v: B) : THIS_TYPE
/**
* Join multiple key/value associations
*
* Creates a new [[Stable]] with all given key/value pairs joined
*/
def joinAll(v: ~[(A, B)]) : THIS_TYPE
/**
* Alias for [[join]]
*
* Creates a new [[Stable]] with given key/value joined
*/
@tn("_join") inline def + (inline key: A, inline v: B): THIS_TYPE = join(key,v)
/**
* Alias for [[joinAll]]
*
* Creates a new [[Stable]] with all given key/value pairs joined
*
*/
@tn("_joinAll") inline def ++(inline v: ~[(A, B)]) : THIS_TYPE = joinAll(v)
object Stable :
/**/ def apply[A,B](v: ~[(A, B)]) : Stable[A,B] = stable.z.Ref(v.iterator)
/**/ def apply[A,B](v: (A, B)*) : Stable[A,B] = stable.z.Ref(v.iterator)
/**
* Get void instance
*/
@tn("getVoid")inline def void[A,B] : Stable[A,B] = stable.z.Void.cast[Stable[A,B]]
/**
* General void instance request
*
* It is possible to use general request \\/ to get void instance of this type, thanks to this implicit conversion.
*/
implicit inline def implicitRequest[A,B](v: \/) : Stable[A,B] = void[A,B]
/*___________________________________________________________________________
__________ ____ __ ______ ____
/ __/ ___// _ | / / / __ / / _ | Scala Quick API
__\ \/ /___/ __ |/ /__/ /_/ /_/ __ | (c) 2021, Scalqa.org Inc
/_____/\____/_/ |_/____/\______/_/ |_| github.com/scalqa
___________________________________________________________________________*/