Expand description
Framework for creating a typeshare binary.
This library provides a macro that creates a fn main
that implements an
entire typeshare binary, using only the Language
implementations that you provide.
The macro is very simple. Supposing that you have implementations of Language
called Kotlin
and Swift
, call the macro like this:
use std::marker::PhantomData;
use typeshare_driver::typeshare_binary;
struct Kotlin {}
// impl<'config> Language<'config> for Kotlin { ... }
struct Swift<'c> {
config: PhantomData<&'config str>;
}
// impl<'config> Language<'config> for Swift<'config> { ... }
typeshare_binary! { Kotlin, Swift<'config> }
This creates an fn main
that uses the functionality in typeshare-engine
to create a complete, working typeshare binary. That binary will include a
complete command-line interface, populated with global options like --config
and --lang
, as well as language-specific options like --kotlin-package
;
these language-specific flags are determined automatically based on the
Config
type provided by each Language
implementation. Use --help
for a complete
description of all CLI options.
See the typeshare_model::Language
docs for details on how to create a specific language implementation.
See the typeshare-engine docs if you want to use typeshare
as a library instead of a binary program; it contains all of the actual logic
for running typeshare. typeshare-driver just bootstraps the functionality
in the engine into a working main
.
Macros§
- typeshare_
binary - Macro that creates an
fn main
with a complete typeshare program, based on theLanguage
implementations provided. See the crate docs for details and an example.