pub struct WorkspaceDiagnostic {
pub path: PathBuf,
pub kind: WorkspaceDiagnosticKind,
pub message: String,
}Expand description
A diagnostic about a workspace-discovery candidate.
The message field is a human-readable rendering derived from kind. It
always ends with a concrete next step (“fix the JSON syntax”, “remove from
workspaces”, “add to ignorePatterns”) so first-time users have a path
forward.
Fields§
§path: PathBufPath to the directory or file that triggered the diagnostic.
kind: WorkspaceDiagnosticKindKind discriminator with the typed payload.
message: StringHuman-readable rendering derived from kind + path. Always ends
with a next-step hint.
Implementations§
Source§impl WorkspaceDiagnostic
impl WorkspaceDiagnostic
Sourcepub fn new(root: &Path, path: PathBuf, kind: WorkspaceDiagnosticKind) -> Self
pub fn new(root: &Path, path: PathBuf, kind: WorkspaceDiagnosticKind) -> Self
Construct a diagnostic with the message rendered from kind + path.
root is used to produce project-relative paths in the message text
AND inside the variant payload (e.g. the error field of
MalformedPackageJson / MalformedTsconfig which embed the absolute
file path from PackageJson::load()’s error text). Without the
payload-side normalisation the embedded path would survive
environment-specific differences (CI vs Docker vs local) because the
post-serialisation strip_root_prefix only catches whole-string
matches, not paths embedded mid-sentence.
If path is not under root (e.g. canonicalisation crossed a
symlink), the absolute path is emitted instead.
Trait Implementations§
Source§impl Clone for WorkspaceDiagnostic
impl Clone for WorkspaceDiagnostic
Source§fn clone(&self) -> WorkspaceDiagnostic
fn clone(&self) -> WorkspaceDiagnostic
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WorkspaceDiagnostic
impl Debug for WorkspaceDiagnostic
Source§impl<'de> Deserialize<'de> for WorkspaceDiagnostic
impl<'de> Deserialize<'de> for WorkspaceDiagnostic
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for WorkspaceDiagnostic
impl JsonSchema for WorkspaceDiagnostic
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more