Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyAppliers[T any](options []Option, target T)
- func ApplyGenericOption[T any](options []Option, applier func(T))
- func ConvertSlice[I any, O any](in []I) (out []O)
- func CopyPtr[T any](t *T) *T
- func CreateSharedSuperIfAbundant[T any](options []Option, constructor GenericConstructor[T], cArgs Args, ...) (*T, error)
- func DeepCopy[T Copyable](copyable Copyable) T
- func ExtractAPDU(options []Option) (apdu readWriteModel.APDU)
- func ExtractIfPresent[T any](options []Option) (T, bool)
- func ExtractLeafName(options []Option, defaultName string) string
- func ExtractNLM(options []Option) (nlm readWriteModel.NLM)
- func ExtractRootMessage(options []Option) (rootMessage spi.Message)
- func GA[T any](args Args, index int) T
- func GAO[T any](args Args, index int, defaultValue T) (T, bool)
- func GetFromArgs[T any](args Args, index int) T
- func GetFromArgsOptional[T any](args Args, index int, defaultValue T) (T, bool)
- func IsNil(v interface{}) bool
- func KW[T any](kwArgs KWArgs, key KnownKey) T
- func KWO[T any](kwArgs KWArgs, key KnownKey, defaultValue T) (T, bool)
- func NK[T any, K NillableKey[T]](value *T) K
- func Nothing() (Args, KWArgs)
- func OR[T comparable](a T, b T) T
- func SortedMapIterator[K cmp.Ordered, V any](m map[K]V) iter.Seq2[K, V]
- func ToPtr[T any](value T) *T
- func ToStringers[I any](in []I) []fmt.Stringer
- func Try(f func() error) (err error)
- func Try1[T any](f func() (T, error)) (v T, err error)
- type Arg
- type Args
- type Comparable
- type Copyable
- type Decoder
- type Encoder
- type Exception
- type GenericApplier
- type GenericConstructor
- type GenericFunction
- type Initializer
- type KWArgs
- type KnownKey
- type LeafNameSupplier
- type NillableKey
- type Option
- func AddIfAbundant[T any](options []Option, value T) []Option
- func AddLeafTypeIfAbundant[T any](options []Option, leaf *T) []Option
- func AddMultiInheritanceSupportIfAbundant(options []Option) []Option
- func AddNLMIfAbundant(options []Option, nlm readWriteModel.NLM) []Option
- func AddRootMessageIfAbundant(options []Option, rootMessage spi.Message) []Option
- func AddSharedSuperIfAbundant[T any](options []Option) []Option
- func AsOption[T any](value T) Option
- func Combine(options []Option, additionalOptions ...Option) []Option
- func WithAPDU(apdu readWriteModel.APDU) Option
- func WithLeafType[T any](leaf *T) Option
- func WithMultiInheritanceSupport() Option
- func WithNLM(nlm readWriteModel.NLM) Option
- func WithRootMessage(rootMessage spi.Message) Option
- func WithSharedSuper[T any]() Option
- type PriorityItem
- type PriorityQueue
- func (pq *PriorityQueue[P, V]) Clear()
- func (pq PriorityQueue[P, V]) Len() int
- func (pq PriorityQueue[P, V]) Less(i, j int) bool
- func (pq *PriorityQueue[P, V]) Pop() any
- func (pq *PriorityQueue[P, V]) Push(x any)
- func (pq PriorityQueue[P, V]) String() string
- func (pq PriorityQueue[P, V]) Swap(i, j int)
- type TypeError
- type Updater
- type ValueError
Constants ¶
const ( KWAddActor = KnownKey("addActor") KWDelActor = KnownKey("delActor") KWActorError = KnownKey("actorError") KWError = KnownKey("error") KWCPCIUserData = KnownKey("user_data") KWCPCISource = KnownKey("source") KWCPCIDestination = KnownKey("destination") KWPCIExpectingReply = KnownKey("expecting_reply") KWPCINetworkPriority = KnownKey("network_priority") KWWirtnNetwork = KnownKey("wirtnNetwork") KWIartnNetworkList = KnownKey("iartnNetworkList") KWIcbrtnNetwork = KnownKey("icbrtnNetwork") KWIcbrtnPerformanceIndex = KnownKey("icbrtnPerformanceIndex") KWRmtnRejectionReason = KnownKey("rmtnRejectionReason") KWRmtnDNET = KnownKey("rmtnDNET") KWRbtnNetworkList = KnownKey("rbtnNetworkList") KWRatnNetworkList = KnownKey("ratnNetworkList") KWIrtTable = KnownKey("irtTable") KWIrtaTable = KnownKey("irtaTable") KWEctnDNET = KnownKey("ectnDNET") KWEctnTerminationTime = KnownKey("ectnTerminationTime") KWDctnDNET = KnownKey("dctnDNET") KWNniNet = KnownKey("nniNet") KWNniFlag = KnownKey("nniFlag") KWBvlciResultCode = KnownKey("bvlciResultCode") KWBvlciBDT = KnownKey("bvlciBDT") KWBvlciAddress = KnownKey("bvlciAddress") KWFdAddress = KnownKey("fdAddress") KWFdTTL = KnownKey("fdTTL") KWFdRemain = KnownKey("fdRemain") KWBvlciTimeToLive = KnownKey("bvlciTimeToLive") KWBvlciFDT = KnownKey("bvlciFDT") KWConfirmedServiceChoice = KnownKey("choice") KWUnconfirmedServiceChoice = KnownKey("choice") KWErrorClass = KnownKey("errorClass") KWErrorCode = KnownKey("errorCode") KWContext = KnownKey("context") KWInvokedID = KnownKey("invokeID") KWObjectName = KnownKey("objectName") KWObjectIdentifier = KnownKey("objectIdentifier") KWMaximumApduLengthAccepted = KnownKey("maximumApduLengthAccepted") KWSegmentationSupported = KnownKey("segmentationSupported") KWMaxSegmentsAccepted = KnownKey("segmentsAccepted") KWNumberOfAPDURetries = KnownKey("numberOfAPDURetries") KWVendorIdentifier = KnownKey("vendorIdentifier") KWCls = KnownKey("cls") )
Variables ¶
var NA = NewArgs
NA is a shortcut for NewArgs
var NKW = NewKWArgs
NKW is a shortcut for NewKWArgs
var NoArgs = NewArgs()
var NoKWArgs = NewKWArgs
Functions ¶
func ApplyAppliers ¶
ApplyAppliers applies all appliers to target if genericOption matches GenericApplier
func ApplyGenericOption ¶
ApplyGenericOption applies to applier if genericOption matches T
func ConvertSlice ¶
func CreateSharedSuperIfAbundant ¶
func CreateSharedSuperIfAbundant[T any](options []Option, constructor GenericConstructor[T], cArgs Args, ckwArgs KWArgs, cOptions ...Option) (*T, error)
CreateSharedSuperIfAbundant is the actual factory/retrieval function used when the actual object is about to be build
func ExtractAPDU ¶
func ExtractAPDU(options []Option) (apdu readWriteModel.APDU)
ExtractAPDU gets a readWriteModel.APDU if present
func ExtractIfPresent ¶
ExtractIfPresent extracts T if present
func ExtractLeafName ¶
ExtractLeafName or return default
func ExtractNLM ¶
func ExtractNLM(options []Option) (nlm readWriteModel.NLM)
ExtractNLM gets a readWriteModel.NLM if present
func ExtractRootMessage ¶
ExtractRootMessage gets a spi.Message if present
func GetFromArgs ¶
GetFromArgs gets a value fromArgs and if not present panics
func GetFromArgsOptional ¶
GetFromArgsOptional gets a value from Args or return default if not present
func SortedMapIterator ¶
SortedMapIterator lets you iterate over an array in a deterministic way
func ToStringers ¶
Types ¶
type Comparable ¶
type GenericApplier ¶
type GenericApplier[T any] genericOption[func(T)]
GenericApplier wraps a func(T) as option
func OptionalOption ¶
func OptionalOption[V any, T any](value *V, opt func(V) GenericApplier[*T]) GenericApplier[*T]
OptionalOption allows options to be applied that might be optional
func OptionalOption2 ¶
func OptionalOption2[V1 any, V2 any, T any](value1 *V1, value2 *V2, opt func(V1, V2) GenericApplier[*T]) GenericApplier[*T]
OptionalOption2 allows options to be applied that might be optional
func WrapGenericApplier ¶
func WrapGenericApplier[T any](applier func(T)) GenericApplier[T]
WrapGenericApplier is a factory function for GenericApplier
type GenericConstructor ¶
GenericConstructor is the generic signature for constructors
type GenericFunction ¶
type Initializer ¶
type LeafNameSupplier ¶
type LeafNameSupplier interface {
GetLeafName() string
}
type NillableKey ¶
NillableKey is a key which can be used in maps
func (NillableKey[T]) String ¶
func (n NillableKey[T]) String() string
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is a generic interface for transporting options which are meant to bubble up
func AddIfAbundant ¶
AddIfAbundant adds a generic Option for T if value is abundant
func AddLeafTypeIfAbundant ¶
AddLeafTypeIfAbundant can be used to add a leaf type if not already set
func AddMultiInheritanceSupportIfAbundant ¶
AddMultiInheritanceSupportIfAbundant adds a WithMultiInheritanceSupport if abundant
func AddNLMIfAbundant ¶
func AddNLMIfAbundant(options []Option, nlm readWriteModel.NLM) []Option
AddNLMIfAbundant can be used to add a readWriteModel.NLM if not present
func AddRootMessageIfAbundant ¶
AddRootMessageIfAbundant can be used to add a spi.Message if not present
func AddSharedSuperIfAbundant ¶
AddSharedSuperIfAbundant adds a WithSharedSuper if abundant
func WithAPDU ¶
func WithAPDU(apdu readWriteModel.APDU) Option
WithAPDU can be used to bubble up a readWriteModel.APDU
func WithLeafType ¶
WithLeafType can be used to add a leaf type
func WithMultiInheritanceSupport ¶
func WithMultiInheritanceSupport() Option
WithMultiInheritanceSupport is a quick way to ensure that multi inheritance is respected from a root node.
func WithNLM ¶
func WithNLM(nlm readWriteModel.NLM) Option
WithNLM can be used to bubble up a readWriteModel.NLM
func WithRootMessage ¶
WithRootMessage can be used to bubble up a spi.Message
func WithSharedSuper ¶
WithSharedSuper adds a shared super holder. Useful in multi-inheritance
type PriorityItem ¶
type PriorityItem[P cmp.Ordered, V any] struct { Value V // The value of the item; arbitrary. Priority P // The priority of the item in the queue. // The Index is needed by update and is maintained by the heap.Interface methods. Index int // The Index of the item in the heap. }
An PriorityItem is something we manage in a priority queue.
func (*PriorityItem[P, V]) String ¶
func (p *PriorityItem[P, V]) String() string
type PriorityQueue ¶
type PriorityQueue[P cmp.Ordered, V any] []*PriorityItem[P, V]
PriorityQueue implements heap.Interface and holds Items.
func (*PriorityQueue[P, V]) Clear ¶
func (pq *PriorityQueue[P, V]) Clear()
func (PriorityQueue[P, V]) Len ¶
func (pq PriorityQueue[P, V]) Len() int
func (PriorityQueue[P, V]) Less ¶
func (pq PriorityQueue[P, V]) Less(i, j int) bool
func (*PriorityQueue[P, V]) Pop ¶
func (pq *PriorityQueue[P, V]) Pop() any
func (*PriorityQueue[P, V]) Push ¶
func (pq *PriorityQueue[P, V]) Push(x any)
func (PriorityQueue[P, V]) String ¶
func (pq PriorityQueue[P, V]) String() string
func (PriorityQueue[P, V]) Swap ¶
func (pq PriorityQueue[P, V]) Swap(i, j int)
type ValueError ¶
type ValueError struct {
Message string
}
func (ValueError) Error ¶
func (m ValueError) Error() string