flowey/
lib.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4#![expect(missing_docs)]
5#![forbid(unsafe_code)]
6
7//! The user-facing flowey API.
8//!
9//! Relying on `flowey_core` directly is not advised, as many APIs exposed at
10//! that level are only supposed to be used by flowey _infrastructure_ (e.g: in
11//! `flowey_cli`).
12
13/// Types and traits for implementing flowey nodes.
14pub mod node {
15    pub mod prelude {
16        // include all user-facing types in the prelude
17        pub use flowey_core::node::user_facing::*;
18
19        // ...in addition, export various types/traits that node impls are
20        // almost certainly going to require
21        pub use anyhow;
22        pub use anyhow::Context;
23        pub use fs_err;
24        pub use log;
25        pub use serde::Deserialize;
26        pub use serde::Serialize;
27        pub use std::path::Path;
28        pub use std::path::PathBuf;
29
30        /// Extension trait to streamline working with [`Path`] in flowey.
31        pub trait FloweyPathExt {
32            /// Alias for [`std::path::absolute`]
33            fn absolute(&self) -> std::io::Result<PathBuf>;
34        }
35
36        impl<T> FloweyPathExt for T
37        where
38            T: AsRef<Path>,
39        {
40            fn absolute(&self) -> std::io::Result<PathBuf> {
41                std::path::absolute(self)
42            }
43        }
44    }
45}
46
47/// Types and traits for implementing flowey pipelines.
48pub mod pipeline {
49    pub mod prelude {
50        pub use flowey_core::pipeline::user_facing::*;
51    }
52}
53
54/// Types and traits for implementing flowey patch functions.
55pub mod patch {
56    pub use flowey_core::patch::*;
57    pub use flowey_core::register_patch;
58}
59
60/// Utility functions.
61pub mod util {
62    pub use flowey_core::util::*;
63}