-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstringly.zig
More file actions
69 lines (61 loc) · 2.57 KB
/
stringly.zig
File metadata and controls
69 lines (61 loc) · 2.57 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const Allocator = struct {};
const CompanyInfo = struct {
name: []const u8,
};
const TrainNetwork = struct {
const Logistics = struct {
const Station = struct {using allocator: *Allocator,};
const Train = struct {using allocator: *Allocator,};
const Scheduler = struct {using allocator: *Allocator,};
scheduler: Scheduler,
stations: [5]Station,
trains: [17]Train,
pub fn firstStation(self: *Logistics) Station {} // hidden parameter injections required (1 *Allocator)
pub fn lastStation(self: *Logistics) Station {} // hidden parameter injections required (1 *Allocator)
pub fn nextStation(self: *Logistics) Station {} // hidden parameter injections required (1 *Allocator)
pub fn prevStation(self: *Logistics) Station {} // hidden parameter injections required (1 *Allocator)
pub fn getTrain(self: *Logistics) Train {} // hidden parameter injections required (1 *Allocator)
};
const Publisher = struct {using allocator: *Allocator, using company_info: *const CompanyInfo,};
const Region = struct {
d: Logistics,
e: Publisher,
};
using allocator: *Allocator
@providing(.{
.{"c[]|c_byname().", .{
"d.scheduler|stations|trains|()Station|()Train.allocator",
"e.allocator",
}},
.{"z.allocator"},
}),
c: Region,
z: TimeVarianceAuthority,
fn c_byname(self: *TrainNetwork, name: []const u8) Region {} // hidden parameter injections required (1 *Allocator, 1 *const CompanyInfo)
fn operate(self: *TrainNetwork) void {} // hidden parameter injections required (1 *Allocator, 1 *const CompanyInfo)
};
const TransportationAuthority = struct {
const company_info = CompanyInfo {
.name = "Earth Transportation Authority",
};
t: [4]TrainNetwork @usingDeclFor(company_info, .{".**"}),
pub fn at(self: *TransportationAuthority, i: u3) TrainNetwork { // hidden parameter injections required (1 *Allocator, 1 *const CompanyInfo)
return self.t[i];
}
};
const A = struct {
a: Allocator
@providing(.{"b.at().allocator"}),
b: TransportationAuthority,
};
const TimeVarianceAuthority = struct {using allocator: Allocator, const info = "redacted";};
fn runTrains(tn: *TrainNetwork) void { // hidden parameter injections required (1 *Allocator, 1 *const CompanyInfo)
tn.operate();
}
fn operateTA(ta: *TransportationAuthority) void { // hidden parameter injections required (1 *Allocator)
ta.at(2).runTrains();
}
test "" {
var a = A{};
a.b.operateTA();
}