Files
pplus-web/mojo/probes/struct-writable.mojo
T
2026-10-05 03:03:38 +00:00

12 lines
238 B
Mojo

# probe: a struct that implements write_to prints through print()
@fieldwise_init
struct P(Writable):
var x: Int
def write_to(self, mut writer: Some[Writer]):
writer.write("P(", self.x, ")")
def main():
print(P(3))