flatbuffers-tonic-build 0.1.1

gRPC with flatbuffers code generator.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::path::Path;

pub(crate) mod flatbuffers_self;
pub(crate) mod flatbuffers_tonic;

/// Currently assumes fbs files are independent.
pub fn compile_flatbuffers_tonic<P>(fbs_path: &[P]) -> Result<(), Box<dyn std::error::Error>>
where
    P: AsRef<Path>,
{
    // Compile flatbuffers first
    flatbuffers_self::compile_flat_buffer_self(fbs_path);

    // Then compile tonic
    flatbuffers_tonic::compile_flatbuffers_tonic_file_list_only(fbs_path)?;
    Ok(())
}