pub enum FileLocationStrategy {
Custom(PathBuf),
FromAutocxxRsFile(PathBuf),
FromAutocxxRs(PathBuf),
FromOutDir(PathBuf),
FromAutocxxRsJsonArchive(PathBuf),
UnknownMaybeFromOutdir,
}Expand description
The strategy used to generate, and to find generated, files. As standard, these are based off the OUT_DIR set by Cargo, but our code can’t assume it can read OUT_DIR as it may be running in the rust-analyzer proc macro server where it’s not available. We need to give provision for custom locations and we need our code generator build script to be able to pass locations through to the proc macro by env vars.
On the whole this class concerns itself with directory names
and allows the actual file name to be determined elsewhere
(based on a hash of the contents of include_cpp!.) But
some types of build system need to know the precise file name
produced by the codegen phase and passed into the macro phase,
so we have some options for that. See gen --help for details.
Variants§
Custom(PathBuf)
FromAutocxxRsFile(PathBuf)
FromAutocxxRs(PathBuf)
FromOutDir(PathBuf)
FromAutocxxRsJsonArchive(PathBuf)
UnknownMaybeFromOutdir
Implementations§
Source§impl FileLocationStrategy
impl FileLocationStrategy
pub fn new() -> Self
pub fn new_custom(gen_dir: PathBuf) -> Self
Sourcepub fn make_include(&self, config: &IncludeCppConfig) -> TokenStream
pub fn make_include(&self, config: &IncludeCppConfig) -> TokenStream
Make a macro to include a given generated Rust file name.
This can’t simply be calculated from get_rs_dir because
of limitations in rust-analyzer.
Sourcepub fn get_rs_dir(&self) -> PathBuf
pub fn get_rs_dir(&self) -> PathBuf
Location to generate Rust files.
Sourcepub fn get_include_dir(&self) -> PathBuf
pub fn get_include_dir(&self) -> PathBuf
Location to generate C++ header files.
Sourcepub fn get_cxx_dir(&self) -> PathBuf
pub fn get_cxx_dir(&self) -> PathBuf
Location to generate C++ code.
Sourcepub fn set_cargo_env_vars_for_build(&self)
pub fn set_cargo_env_vars_for_build(&self)
From a build script, inform cargo how to set environment variables to make them available to the procedural macro.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileLocationStrategy
impl RefUnwindSafe for FileLocationStrategy
impl Send for FileLocationStrategy
impl Sync for FileLocationStrategy
impl Unpin for FileLocationStrategy
impl UnwindSafe for FileLocationStrategy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more