mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-18 14:29:57 +00:00
Use portable paths when serializing sources (#7504)
## Summary Closes https://github.com/astral-sh/uv/issues/7493.
This commit is contained in:
parent
1379b530f6
commit
e36cc99b0d
8 changed files with 70 additions and 36 deletions
|
@ -301,6 +301,17 @@ pub struct PortablePath<'a>(&'a Path);
|
|||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct PortablePathBuf(PathBuf);
|
||||
|
||||
#[cfg(feature = "schemars")]
|
||||
impl schemars::JsonSchema for PortablePathBuf {
|
||||
fn schema_name() -> String {
|
||||
PathBuf::schema_name()
|
||||
}
|
||||
|
||||
fn json_schema(_gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
|
||||
PathBuf::json_schema(_gen)
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<Path> for PortablePath<'_> {
|
||||
fn as_ref(&self) -> &Path {
|
||||
self.0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue