<commit_before>/*
Package capnp is a Cap'n Proto library for Go.
https://capnproto.org/

Generating code

capnpc-go provides the compiler backend for capnp.

	# First, install capnpc-go to $PATH.
	go install zombiezen.com/go/capnproto2/capnpc-go
	# Then, generate Go files.
	capnp compile -ogo *.capnp

capnpc-go requires two annotations for all files: package and import.
package is needed to know what package to place at the head of the
generated file and what identifier to use when referring to the type
from another package.  import should be the fully qualified import path
and is used to generate import statement from other packages and to
detect when two types are in the same package.  For example:

	using Go = import "zombiezen.com/go/capnproto2/go.capnp";
	$Go.package("main");
	$Go.import("zombiezen.com/go/capnproto2/example");

For adding documentation comments to the generated code, there's the doc
annotation. This annotation adds the comment to a struct, enum or field so
that godoc will pick it up. For example:

	struct Zdate $Go.doc("Zdate represents a calendar date") {
	  year  @0   :Int16;
	  month @1   :UInt8;
	  day   @2   :UInt8 ;
	}

Messages and Segments

In Cap'n Proto, the unit of communication is a message. A message
consists of one or more segments -- contiguous blocks of memory.  This
allows large messages to be split up and loaded independently or lazily.
Typically you will use one segment per message.  Logically, a message is
organized in a tree of objects, with the root always being a struct (as
opposed to a list or primitive).  Messages can be read from and written
to a stream.

Pointers

The interface for accessing a Cap'n Proto object is Pointer.  This can
refer to a struct, a list, or an interface.  Pointers have value
semantics and refer to data in a single segment.  All of the concrete
pointer types have a notion of "valid".  An invalid pointer will return
the default value from any accessor and panic when any setter is called.

Data accessors and setters (i.e. struct primitive fields and list
elements) do not return errors, but pointer accessors and setters do.
There are a reasons that a read or write of a pointer can fail, but the
most common are bad pointers or allocation failures.  For accessors, an
invalid object will be returned in case of an error.

Since Go doesn't have generics, wrapper types provide type safety on
lists.  This package provides lists of basic types, and capnpc-go
generates list wrappers for named types.  However, if you need to use
deeper nesting of lists (e.g. List(List(UInt8))), you will need to use a
PointerList and wrap the elements.

Structs

For the following schema:<commit_msg>capnp: update Pointer docs to Ptr<commit_after>/*
Package capnp is a Cap'n Proto library for Go.
https://capnproto.org/

Generating code

capnpc-go provides the compiler backend for capnp.

	# First, install capnpc-go to $PATH.
	go install zombiezen.com/go/capnproto2/capnpc-go
	# Then, generate Go files.
	capnp compile -ogo *.capnp

capnpc-go requires two annotations for all files: package and import.
package is needed to know what package to place at the head of the
generated file and what identifier to use when referring to the type
from another package.  import should be the fully qualified import path
and is used to generate import statement from other packages and to
detect when two types are in the same package.  For example:

	using Go = import "zombiezen.com/go/capnproto2/go.capnp";
	$Go.package("main");
	$Go.import("zombiezen.com/go/capnproto2/example");

For adding documentation comments to the generated code, there's the doc
annotation. This annotation adds the comment to a struct, enum or field so
that godoc will pick it up. For example:

	struct Zdate $Go.doc("Zdate represents a calendar date") {
	  year  @0   :Int16;
	  month @1   :UInt8;
	  day   @2   :UInt8 ;
	}

Messages and Segments

In Cap'n Proto, the unit of communication is a message. A message
consists of one or more segments -- contiguous blocks of memory.  This
allows large messages to be split up and loaded independently or lazily.
Typically you will use one segment per message.  Logically, a message is
organized in a tree of objects, with the root always being a struct (as
opposed to a list or primitive).  Messages can be read from and written
to a stream.

Pointers

The type for a generic reference to a Cap'n Proto object is Ptr.  A Ptr
can refer to a struct, a list, or an interface.  Ptr, Struct, List, and
Interface (the pointer types) have value semantics and refer to data in
a single segment.  All of the pointer types have a notion of "valid".
An invalid pointer will return the default value from any accessor and
panic when any setter is called.

In previous versions of this package, the Pointer interface was used
instead of the Ptr struct.  This interface and functions that use it are
now deprecated.  See https://github.com/zombiezen/go-capnproto2/wiki/New-Ptr-Type
for details about this API change.

Data accessors and setters (i.e. struct primitive fields and list
elements) do not return errors, but pointer accessors and setters do.
There are a few reasons that a read or write of a pointer can fail, but
the most common are bad pointers or allocation failures.  For accessors,
an invalid object will be returned in case of an error.

Since Go doesn't have generics, wrapper types provide type safety on
lists.  This package provides lists of basic types, and capnpc-go
generates list wrappers for named types.  However, if you need to use
deeper nesting of lists (e.g. List(List(UInt8))), you will need to use a
PointerList and wrap the elements.

Structs

For the following schema:
{'fraction_non_alphanumeric': 0.05215100965759438, 'fraction_numerical': 0.004038630377524144, 'mean_word_length': 4.005272407732865, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '541171', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1559, 'n_words': 881}