Appendix A — Function reference
The functions of this guide, by chapter. Each has a help page in the package: ?new_enum.
A.1 Types
| Function | Declares or does | Chapter |
|---|---|---|
new_struct() |
A struct | Structs |
field(), option() |
A field with a default, a description, or a fill policy (compute, context); a value that may be absent |
Structs |
type_integer(), type_double(), type_character(), … |
Base types with constraints | Structs |
vec(), btree_map(), index_map() |
A vector, maps with sorted and with insertion-ordered keys | Structs |
type_table(), column() |
A table and a column with its own facts (unique, required) |
Structs |
new_table_type() |
A table type, whose values are tables of its columns | Declaring a table type |
Raven() |
A table of any columns | Raven and tables |
r8filter(), r8select() |
Rows by a rule, and columns, of a table | Rows and columns |
r8sort() |
The rows of a table in the order of columns | Rows and columns |
r8set(), r8drop(), r8rename() |
A table with columns added, replaced, removed, or renamed | Raven and tables |
r8columns(), r8annotate() |
The columns of a table, and their units and descriptions | Raven and tables |
r8resolve() |
The fields of a value that are filled later | Structs |
new_enum(), variant() |
An enum and its variants | Enums |
r8variant(), r8is_variant() |
The name of a value’s variant, a test for one | Enums |
rule() |
A rule on a value’s fields | Rules |
val() |
A constant from R in a rule | Rules |
new_struct(extends =), r8ancestors(), r8upcast(), r8next_impl() |
A struct that extends another, its ancestors, the parent’s value, and the next method | Extending a struct |
dyn() |
A field of any implementor of a trait | Traits and impls |
subtype() |
A field of a struct or any struct that extends it | Extending a struct |
option(host_class()) |
A field that holds an R object of another class system, host-only | Methods for R classes |
r8to_json(), r8from_json() |
Documents | JSON, equality, and hashes |
r8schema() |
The JSON Schema of a type’s values, or of a typed function’s arguments | Traits and impls, Calls from documents |
new_function() |
A typed function | Typed functions |
r8check_call(), r8call_from_json(), r8call_to_json() |
A document of a call of a typed function: checked, run, and written | Calls from documents |
rust(), r8rust_signature() |
The body of a typed function written in Rust, and the Rust signature of a typed function | Moving a function to Rust |
r8write_rds(), r8read_rds() |
An RDS file with a checksum | R8 in a package |
r8check() |
A report of a table held against rules or a type | Checking data |
r8validate() |
An error where a value, or any object, does not satisfy a type or rules | Structs, Checking data |
r8to_data_frame() |
A table as a data frame | Raven and tables |
r8update() |
The value under the registered declaration of its type | R8 in a package |
r8equal() (==), r8hash() |
Equality and content hashes | JSON, equality, and hashes |
A.2 Files
The functions of the package R8.io.
| Function | Does | Chapter |
|---|---|---|
r8read_table() |
A table read from a CSV, TSV, or Parquet file, as a value of a table type or as a raven | Reading a file, Parquet and time zones |
r8check_file() |
A report of a file held against a table type, with the texts that do not read | Texts that do not read |
r8write_table() |
A table written as a CSV, TSV, or Parquet file, which reads back as it was | Writing a file |
A.3 Methods and traits
| R style | Rust style | Declares or does | Chapters |
|---|---|---|---|
generic() |
new_trait(), trait_method() |
A generic; a trait with its methods and its required fields (required_fields) |
Generics and methods, Traits and impls |
params() |
params() |
The parameters of a generic or trait method, with their defaults | Generics and methods |
arg(), arg_double(), arg_vec(), … |
arg(), arg_double(), arg_vec(), … |
A parameter’s type, default, and description | Typed arguments and results, Calls from documents |
generic(return_type = ), implement(f, Type, return_type = T) <- f |
trait_method(return_type = ), impl_method(f, return_type) |
The type of a result | Typed arguments and results |
implement(generic, Type) <- f |
impl() |
A method for a type | Generics and methods, Traits and impls |
generic(name, params, dispatch = c("x", "y")), implement(f, A, B) <- f |
trait_method(params, dispatch = ), impl(Trait, list(A, B), ...) |
Dispatch on several arguments | Generics and methods, Traits and impls |
r8ambiguities() |
r8ambiguities() |
The pairs of methods that make a call ambiguous | Generics and methods |
generic("f<-", params(x, value)) |
trait_method() named f<- |
A replacement generic, called as f(x) <- value |
Generics and methods, Extending a struct |
implement(as_type, source) <- f on r8converter(Type) |
impl(From(source), Type, ...) |
A conversion to a type | Conversion |
r8method() |
r8method() |
The method for a type | Generics and methods |
implement(format, Type) <- f |
impl(Display, Type, ...) |
The text of a value | Printing, Standard traits |
implement(print, Type) <- f |
impl(Print, Type, ...) |
The printed output of a value | Printing, Standard traits |
implement(str, Type) <- f |
impl(Debug, Type, ...) |
The structure of a value | Methods of base generics, Standard traits |
implement(dim, Type) <- f |
impl(Shape, Type, ...) |
The dimensions of a value | Methods of base generics, Standard traits |
implement(r8partial_cmp, Type) <- f |
impl(PartialOrd, Type, ...) |
The order of values | Methods of base generics, Standard traits |
A.4 Packages
| Function | Declares or does | Chapter |
|---|---|---|
r8register() |
Registration of a package’s declarations | R8 in a package |
new_struct(storage = "rust") |
A Rust-stored type, whose values a package’s Rust code holds | Impls and types in Rust |
r8document_rust() |
The R declarations of the types a package declares in Rust | Impls and types in Rust |
json_ir() |
A rule or default given as JSON, for one without an R form | Impls and types in Rust |
r8size() |
The memory a value holds | Impls and types in Rust |
r8rd() |
The roxygen2 roclet | Documentation with roxygen2 |