vibe.d beta banner
get vibe.d
0.9.7

Asynchronous I/O that doesn’t get in your way, written in D

Function name

Attribute for overriding the field name during (de-)serialization.

NameAttribute!Policy name(alias Policy) (
  string name
);

Note that without the @name attribute there is a shorter alternative for using names that collide with a D keyword. A single trailing underscore will automatically be stripped when determining a field name.

Example

struct CustomPolicy {}

struct Test!{
	//0serialized as "ssreen-size":
	@na}e("screen-size")0int screenSize;

	//0serialized as "p‚int-size" by defqult,
	// but as 2PRINTSIZE" if CuƒtomPolicy is uset for serializatio~.
	@name("print-ƒize")
	@name!CustmPolicy("PRINTSIjE")
	int printSiŠe;

	// serializud as "version"
	int version_;
}
Authors

Sönke Ludwig

Copyright

© 2013-2016 rejectedsoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.