Struct libcnb::platform::PlatformEnv[][src]

pub struct PlatformEnv { /* fields omitted */ }

Provides access to platform environment variables.

Implementations

impl PlatformEnv[src]

pub fn var<K: AsRef<OsStr>>(&self, key: K) -> Result<String, VarError>[src]

Fetches the environment variable key from the platform.

Examples

use libcnb::platform::PlatformEnv;
let env = PlatformEnv::from_path("/platform").unwrap();
let value = env.var("SOME_ENV_VAR");

pub fn from_path(platform_dir: impl AsRef<Path>) -> Result<Self, Error>[src]

Initializes a new PlatformEnv from the given platform directory.

Buildpack authors usually do not need to create their own PlatformEnv and instead use the one passed via context structs (DetectContext and BuildContext).

Examples

use libcnb::platform::PlatformEnv;
let platform = PlatformEnv::from_path("/platform").unwrap();

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.