pulumi_wasm_rust/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
mod output;
pub use output::Output;
pub use output::ToOutput;

#[doc(hidden)]
#[path = "private/mod.rs"]
pub mod __private;
mod context;
mod input_or_output;
mod oneof;
pub use input_or_output::InputOrOutput;

pub use context::PulumiContext;

pub use oneof::OneOf2;
pub use oneof::OneOf3;
pub use oneof::OneOf4;

/// Add given [Output] to [Stack Output](https://www.pulumi.com/tutorials/building-with-pulumi/stack-outputs/)
pub fn add_export<T>(name: &str, output: &Output<T>) {
    output.add_to_export(name);
}

/// Load specific generated provider
///
/// build.rs:
/// ```rust,no_run
/// use std::error::Error;
/// fn main() -> Result<(), Box<dyn Error>> {
///     pulumi_wasm_build::generate("random", "4.15.0")?;
///     Ok(())
/// }
/// ```
///
/// lib.rs
/// ```rust,ignore
/// include_provider!("random");
/// ```
#[macro_export]
macro_rules! include_provider {
    ($file:expr) => {
        include!(concat!(env!("OUT_DIR"), "/pulumi/", $file, "/main.rs"));
    };
}

/// Generate boilerplate for Wasm entrypoint
///
/// ```rust,no_run
/// use pulumi_wasm_rust::*;
/// use anyhow::Result;
///
/// pulumi_main!();
///
/// fn pulumi_main(context: &PulumiContext) -> Result<()> {
///    Ok(())
/// }
/// ```
#[macro_export]
macro_rules! pulumi_main {
    () => {
        #[export_name = "component:pulumi-wasm-external/pulumi-main@0.0.0-STABLE-DEV#main"]
        unsafe extern "C" fn __exported(arg: i32) {
            let mapped = arg as u8;

            pulumi_wasm_rust::__private::runner::run(mapped, |engine| pulumi_main(&engine))
                .unwrap();
        }
    };
}