use crate::RustLibrary;
use crate::config::{HeaderConfig, SearchPathConfig};
use crate::dispatch::Dispatch;
use crate::pipeline::RustLibraryConfig;
use interoptopus::inventory::RustInventory;
use interoptopus_backends::template::TemplateEngine;
#[derive(Default)]
pub struct RustLibraryBuilder {
inventory: RustInventory,
config: RustLibraryConfig,
}
impl RustLibraryBuilder {
pub(crate) fn new(inventory: RustInventory) -> Self {
Self { inventory, ..Self::default() }
}
#[must_use]
pub fn dispatch(mut self, dispatch: Dispatch) -> Self {
self.config.output_master.dispatch = dispatch;
self
}
#[must_use]
pub fn dll_name(mut self, dll_name: impl AsRef<str>) -> Self {
self.config.meta_info.dll_name = dll_name.as_ref().to_string();
self
}
#[must_use]
pub fn header_config(mut self, header_config: HeaderConfig) -> Self {
self.config.output_header = header_config;
self
}
#[must_use]
pub fn search_path_config(mut self, search_path: SearchPathConfig) -> Self {
self.config.output_search_path = search_path;
self
}
fn templates(mut self, templates: TemplateEngine) -> Self {
self.config.output_master.templates = templates;
self
}
#[must_use]
pub fn build(self) -> RustLibrary {
RustLibrary::with_config(self.inventory, self.config)
}
}