~otheb/bare

ref: 2e14339b677d15c6b73683942084f67917f1ee06 bare/main.d -rw-r--r-- 429 bytes
2e14339bOlie Ayre Support enums 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import bare ;

import std.stdio ;

import std.typecons ;

struct NamedPoint {
	uint   x    ;
	uint   y    ;
	string name ;

	this( uint x_ , uint y_ , string n ) {
		x    = x_ ;
		y    = y_ ;
		name = n  ;
	}
}

void main() {
	auto a = writeb( Nullable!int( 1234 ) ) ;
	readb!( Nullable!int )( a ).writeln() ;

	auto p = NamedPoint( 123 , 456 , "descriptive name" ) ;
	auto d = writeb( p ) ;
	readb!NamedPoint( d ).writeln() ;
}