embedNullable

Makes this nullable as if it is not a nullable to the serializer. Ignores the field completely when it is null.

Works with Nullable!classes and Nullable!structs. Behavior is undefined if this is applied to other types.

Implicitly marks this as optional for deserialization. (Keeps the struct default value when not present in serialized value)

@property
embedNullable
()
()

Examples

import std.typecons : Nullable;

struct Test {
	// Not serialized at all if null, ignored on deserialization if not present.
	@embedNullable Nullable!int field;
}

Meta