Trait Platform

Source
pub trait Platform
where Self: Sized,
{ // Required methods fn env(&self) -> &Env; fn from_path(platform_dir: impl AsRef<Path>) -> Result<Self>; }
Expand description

Represents a Cloud Native Buildpack platform.

Most buildpacks target a generic platform and this library provides a crate::generic::GenericPlatform for that use-case. Buildpack authors usually do not need to implement this trait. See detection and build in the buildpack specification for details.

Required Methods§

Source

fn env(&self) -> &Env

Retrieve a Env reference for convenient access to environment variables which all platforms have to provide.

Source

fn from_path(platform_dir: impl AsRef<Path>) -> Result<Self>

Initializes the platform from the given platform directory.

§Examples
use libcnb::generic::GenericPlatform;
use libcnb::Platform;
let platform = GenericPlatform::from_path("/platform").unwrap();

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§