fix: infinite recursion bug

add `Immutable` trait (Type: !Immutable)
This commit is contained in:
Shunsuke Shibayama 2024-09-04 20:38:46 +09:00
parent de92e295dc
commit f9eb562848
26 changed files with 415 additions and 163 deletions

View file

@ -6,6 +6,7 @@ use std::path::{Component, Path, PathBuf};
use crate::consts::PYTHON_MODE;
use crate::env::erg_pkgs_path;
use crate::traits::Immutable;
use crate::{normalize_path, Str};
/// Guaranteed equivalence path.
@ -16,6 +17,8 @@ use crate::{normalize_path, Str};
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, PartialOrd, Ord)]
pub struct NormalizedPathBuf(PathBuf);
impl Immutable for NormalizedPathBuf {}
impl fmt::Display for NormalizedPathBuf {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.display())