Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/cpp/classes_and_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ Crubit will generate a struct with the same layout:
<!-- class:Position -->


Which can be used like this:

```
{{ #include ../../examples/cpp/trivial_struct/main.rs }}
```
<!-- function:main -->


For an example of a Rust-movable class with a destructor, see
[examples/cpp/trivial_abi_struct/](https://github.com/google/crubit/tree/main/examples/cpp/trivial_abi_struct/).

Expand Down
10 changes: 9 additions & 1 deletion docs/cpp/enums.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ Crubit will generate the following bindings:
```
{{ #include ../../examples/cpp/enum/example_generated.rs }}
```
<!-- class:Color -->
<!-- content:^([^/#\n]|#[^!]|///)[^\n]* -->


Which can be used like this:

```
{{ #include ../../examples/cpp/enum/main.rs }}
```
<!-- function:main -->


## Why isn't it an `enum`?
Expand Down
24 changes: 24 additions & 0 deletions docs/cpp/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ calls into the corresponding FFI glue:
<!-- function:add_two_integers -->


Which can be used like this:

```
{{ #include ../../examples/cpp/function/main.rs }}
```
<!-- function:main -->


### Methods

Given the following C++ header:
Expand All @@ -61,6 +69,14 @@ Crubit will generate the following bindings:
<!-- content:"(?m)impl Bar.*?(^$|^ \})" -->


Which can be used like this:

```
{{ #include ../../examples/cpp/method/main.rs }}
```
<!-- function:main -->


### `unsafe` functions {#unsafe}

#### Which C++ functions are marked `unsafe` in Rust? {#unsafe-inference}
Expand Down Expand Up @@ -89,6 +105,14 @@ Crubit will generate the following bindings:
<!-- content:^([^/\n])([^!\n]|$)[^\n]* -->


Which can be used like this:

```
{{ #include ../../examples/cpp/unsafe_attributes/main.rs }}
```
<!-- function:main -->


#### Correct usage of `unsafe` {#using-unsafe}

Functions marked **`unsafe`** cannot be called outside of an `unsafe` block. In
Expand Down