From 2bfc0e0d9a4b5bdeea3ada028dbb6b7b29eebba7 Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Sun, 25 Aug 2013 17:51:23 -0700 Subject: [PATCH] update docs for constants --- docs/quickstart.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index cf632d8..a185de3 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -16,7 +16,9 @@ First you need to import the library:: Then you can load the Cap'n Proto schema with:: - capnp.load('addressbook.capnp') + addressbook = capnp.load('addressbook.capnp') + +Note that we assign the loaded module to a variable, named `addressbook`. We'll use this from now on to access the Cap'n Proto schema, ie. when we need to get a Struct's class or accessing const values. You can also provide an absolute path to the Cap'n Proto schema you wish to load. Otherwise, it will only look in the current working directory. @@ -25,6 +27,8 @@ For future reference, here is the Cap'n Proto schema. Also available in the gith # addressbook.capnp 0x934efea7f017fff0; + const qux :UInt32 = 123; + struct Person { id @0 :UInt32; name @1 :Text; @@ -55,6 +59,14 @@ For future reference, here is the Cap'n Proto schema. Also available in the gith people @0 :List(Person); } +Const values +~~~~~~~~~~~~~~ + +Const values show up just as you'd expect under the loaded schema. For example:: + + print addressbook.qux + # 123 + Build a message ------------------