blob: 4db86cc62004522f090ddbe9f249725dcf3aa7cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import streams
import strformat
import protobuf/stream
import addressbook_pb
let pbsi = newProtobufStream(newFileStream("addressbook.dat"))
let addressBook = readAddressBook(pbsi)
for person in addressBook.people:
echo("---")
echo(&"Id: {person.id}")
echo(&"Name: {person.name}")
echo(&"Email: {person.email}")
echo("Phones:")
for phone in person.phones:
echo(&" {phone.type} {phone.number}")
|