Skip to main content

launch/
lib.rs

1#![deny(unsafe_code)]
2
3pub mod discovery;
4pub mod error;
5pub mod fs;
6pub mod signal;
7pub mod signals;
8pub mod types;
9
10pub use discovery::{discover, generate, walk_local};
11pub use error::LaunchError;
12pub use fs::{DirEntry, FileSystem, LocalFs, MemoryFs, RootedFs};
13pub use signal::{Signal, SignalOutput};
14pub use types::*;
15
16use std::path::Path;
17
18/// Discover services in a directory using the default signal set and local filesystem.
19/// Uses gitignore-aware walking to skip files the project itself ignores.
20pub fn discover_local(root: &Path) -> Result<Discovery, LaunchError> {
21    let fs = RootedFs::new(root);
22    let signals = signals::default_signals();
23    discovery::discover_local_impl(root, signals, &fs)
24}
25
26/// Discover using a custom filesystem and signal set. For testing.
27pub fn discover_with_fs(
28    root: &Path,
29    signals: Vec<Box<dyn Signal>>,
30    fs: &dyn FileSystem,
31) -> Result<Discovery, LaunchError> {
32    discover(root, signals, fs)
33}