pub struct CrateConfig {
skip_generating: bool,
additive_content: Option<String>,
lib: LibraryConfig,
build: BuildConfig,
tests: BTreeMap<String, TestConfig>,
binaries: BTreeMap<String, BinaryConfig>,
}Expand description
Extra configuration for the Bazel targets generated for a crate.
We should try to make generating BUILD.bazel files is as seamless as possible, but there are
instances where this isn’t possible. For example, some tests rely on text-based snapshot files
that Bazel needs to know about so it can include them in the sandbox. But Rust/Cargo has no way
of formally declaring a dependency on these files so we must manually specify them.
Fields§
§skip_generating: boolShould we skip generating a BUILD.bazel file entirely for this crate.
additive_content: Option<String>Additive content we paste at the bottom of the generated BUILD.bazel file.
lib: LibraryConfigExtra config for the rust_library target.
build: BuildConfigExtra config for the cargo_build_script target.
tests: BTreeMap<String, TestConfig>Extra config for any test targets.
binaries: BTreeMap<String, BinaryConfig>Extra config for any binary targets.
Implementations§
Source§impl CrateConfig
impl CrateConfig
pub fn new(package: &PackageMetadata<'_>) -> Self
pub fn skip_generating(&self) -> bool
pub fn additive_content(&self) -> Option<AdditiveContent>
pub fn lib(&self) -> &LibraryConfig
pub fn lib_test(&self) -> &TestConfig
pub fn doc_test(&self) -> &TestConfig
pub fn build(&self) -> &BuildConfig
pub fn test(&self, name: &str) -> &TestConfig
pub fn binary(&self, name: &str) -> &BinaryConfig
Trait Implementations§
Source§impl Debug for CrateConfig
impl Debug for CrateConfig
Source§impl Default for CrateConfig
impl Default for CrateConfig
Source§fn default() -> CrateConfig
fn default() -> CrateConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for CrateConfig
impl<'de> Deserialize<'de> for CrateConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CrateConfig
impl RefUnwindSafe for CrateConfig
impl Send for CrateConfig
impl Sync for CrateConfig
impl Unpin for CrateConfig
impl UnwindSafe for CrateConfig
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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