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
70
71
72
73
74
75
// pub use gelx_core::GelxCoreError;
// pub use gelx_core::GelxCoreResult;
// pub use gelx_core::GelxMetadata;
/// Enables reading from the configuration in the `Cargo.toml`. This returns the
/// [`GelxMetadata`] struct which can be used to customise the generated code
/// via [`set_metadata_env`].
///
/// ```
/// // build.rs
/// use gelx_build::GelxCoreResult;
/// use gelx_build::gelx_build;
/// use gelx_build::tokio;
///
/// #[tokio::main]
/// async fn main() -> GelxCoreResult<()> {
/// gelx_build().await?;
/// Ok(())
/// }
/// ```
///
/// To customise the generated code, you can use the [`GelxMetadata`] struct
/// to set the [`GelxMetadata::queries_path`] and [`GelxMetadata::features`]
/// fields.
///
/// ```
/// // build.rs
/// use std::path::PathBuf;
///
/// use gelx_build::GelxCoreResult;
/// use gelx_build::gelx_build;
/// use gelx_build::set_metadata_env;
/// use gelx_build::tokio;
/// use gelx_core::GelxFeatures;
///
/// #[tokio::main]
/// async fn main() -> GelxCoreResult<()> {
/// let mut metadata = gelx_build().await?;
/// metadata.queries_path = PathBuf::from("queries");
/// metadata.features = GelxFeatures::default();
/// set_metadata_env(&metadata)?;
///
/// Ok(())
/// }
/// ```
pub async
/// Sets the `GELX_METADATA_BASE64` environment variable to the base64 encoded
/// [`GelxMetadata`] struct.
/// Enables reading from the configuration in the `Cargo.toml` in a sync
/// environment. See [`gelx_build`] for more information.
///
/// ```
/// // build.rs
/// use gelx_build::gelx_build_sync;
/// use gelx_core::GelxCoreResult;
///
/// fn main() -> GelxCoreResult<()> {
/// let metadata = gelx_build_sync()?;
/// Ok(())
/// }
/// ```