I have the following pattern: An interface for serializing files, called IFileSerializer, which has multiple concrete implementations. Not every seri ...
I have the following pattern: An interface for serializing files, called IFileSerializer, which has multiple concrete implementations. Not every seri ...
I am trying to make use of generics when writing an asserting function for testing things however it gives me an error Some does not implement TestUti ...
I'm trying to create a basic transformation pipeline in swift. Here is what I have so far My issue is related to the use of generics, but I have be ...
I'm looking for way to store some objects (which have a common behaviour but related to different kinds of structs) and access them through a keyword. ...
Here's my src/main.rs file: use chrono_tz::Tz; use chrono::FixedOffset; use chrono::{NaiveDateTime, TimeZone, NaiveDate}; fn my_func(from_tz: Tz, n ...
I have an enum that holds variants which contain certain types. I want to write a get method that automatically returns the right type if the enum var ...
I have generic interface... And when I implement functionality with some child class... I'm bothered with the fact that I have to pass the same ...
Let's say I have this class: class Class<T extends num> { const Class(this.n); final T n; @override String toString() { return ' ...
In this example, I'm using a parameter type (keyof TFoo)[] to expect an array that includes any keys from TFoo, to keep the example simple, but I'm se ...
I feel this should be easy, but I'm stuck I can easily do a frequency count of a specific type (like u8), but how can I make it generic to allow count ...
I want to write a generic wrapper function called foo that takes an object o and a key k plus some args and calls o[k](...args) in a type-safe manner ...
I’m trying to do the following: with: but Kotlin doesn’t recognize that MClickMapper is a subclass of RFMFunction<MClick, Event>. I tried ...
I would like to make a generic structure with closures, trying to model the finite state machine with Rust. A finite state machine holds two mappings( ...
Consider the following code import SwiftUI struct ContentView: View { var content: () -> some View var body: some View { content() ...
Imagine I have 3 rules : Rule<A>, Rule<B>, Rule<C> Same I have 3 datasources : Datasource<A>, Datasource<B>, Datasource& ...
Introduction (Apologies if the title is confusing, but I explain the question better here!) I'm building a networking library that can perform JSON ...
In Scala 2, you can of course use use wildcard or existential types as type arguments. However, this means that you do not always have a name for a ty ...
I have a function that returns an array as chunks: I now want to create an overload that allows the consumer to auto fill the last chunk with nils: ...
Consider the following code, which has been stripped back to illustrate only the problem with generics: interface Node interface GenericNode<T : ...
I have a function that converts a DataTable to a List of an object. I use reflection to get the properties of the type T given. I use it this way : ...