I bask originally this qustion in this thread : http://forum.dlang.org/post/rsnswykpjfzenpliv...@forum.dlang.org
but another thread is better as that is not exactly same topic. I would like to use custom annotate/attribute on members as: struct A { @Parser( start = "( word ) => word[0] == '>'", end = "( word ) => word[0] == '\n'" ) string header; } but it seem we can't use curstom annotation in D and mxin in this case are not easy. This custom attribute is a metadata to explain how to retrieve this field from a file. This will aloow to create a global parser and give to this parrser data structure to get back. Parser could to b an input range were hront give currentfilled struct and popfront will look foward in buffer given by file.byChunk() using this metadata. When all field are filled give the instance to front …