1use core::fmt;
2
3use schemars::JsonSchema;
4use serde::Deserialize;
5use serde::Serialize;
6
7use crate::TypedPath;
8
9#[allow(clippy::large_enum_variant)]
10#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, Hash, ts_rs::TS, JsonSchema)]
11#[serde(tag = "type")]
12pub enum ModulePath {
13 Main,
15 Local {
16 value: TypedPath,
17 original_import_path: Option<TypedPath>,
18 },
19 Std {
20 value: String,
21 },
22}
23
24impl fmt::Display for ModulePath {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 match self {
27 ModulePath::Main => write!(f, "main"),
28 ModulePath::Local { value: path, .. } => path.fmt(f),
29 ModulePath::Std { value: s } => write!(f, "std::{s}"),
30 }
31 }
32}