Remove some duplication in the documentation of API that's shared between Rust and C++

This change makes the start of sharing the docs for the `TimerMode` enum
between Rust and C++. The reference to Timer::start in there works as
both doxygen and rustdoc find the right reference, but this needs
careful editing in the future and double-checking!

Another "caveat" is that the docs for the TimerMode enum say that the
enum is defined in the file "sixtyfps_generated_public.h", which is
correct as-is but not as pretty as "sixtyfps.h". I tried various ways
with \file and \includedoc, but couldn't get it working differently.

To implement this, the cppdocs steps now also runs cbindgen and cbindgen
generates a new sixtyfps_generated_public.h file that contains types we
do want to have in the public sixtyfps namespace.
This commit is contained in:
Simon Hausmann 2022-01-05 14:40:17 +01:00 committed by Simon Hausmann
parent 81602353e2
commit 174fd2659f
6 changed files with 72 additions and 36 deletions

View file

@ -7,6 +7,9 @@ use anyhow::{Context, Result};
use std::ffi::OsString;
use std::path::{Path, PathBuf};
#[path = "../../api/sixtyfps-cpp/cbindgen.rs"]
mod cbindgen;
fn symlink_file<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> Result<()> {
if dst.as_ref().exists() {
std::fs::remove_file(dst.as_ref()).context("Error removing old symlink")?;
@ -80,6 +83,9 @@ pub fn generate(show_warnings: bool) -> Result<(), Box<dyn std::error::Error>> {
docs_build_dir.join("README.md"),
)?;
let generated_headers_dir = docs_build_dir.join("generated_include");
cbindgen::gen_all(&root, &generated_headers_dir)?;
let pip_env = vec![(OsString::from("PIPENV_PIPFILE"), docs_source_dir.join("docs/Pipfile"))];
println!("Running pipenv install");