macro_rules! buildpack_main {
($buildpack:expr) => { ... };
}Expand description
Generates a main function for the given buildpack.
It will create the main function and wires up the buildpack to the framework.
ยงExample:
use libcnb::build::{BuildContext, BuildResult, BuildResultBuilder};
use libcnb::detect::{DetectContext, DetectResult, DetectResultBuilder};
use libcnb::generic::{GenericError, GenericMetadata, GenericPlatform};
use libcnb::{buildpack_main, Buildpack};
pub(crate) struct MyBuildpack;
impl Buildpack for MyBuildpack {
type Platform = GenericPlatform;
type Metadata = GenericMetadata;
type Error = GenericError;
fn detect(
&self,
context: DetectContext<Self>,
) -> libcnb::Result<DetectResult, Self::Error> {
DetectResultBuilder::pass().build()
}
fn build(&self, context: BuildContext<Self>) -> libcnb::Result<BuildResult, Self::Error> {
BuildResultBuilder::new().build()
}
}
buildpack_main!(MyBuildpack);