-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69c72b6
commit 1063623
Showing
14 changed files
with
172 additions
and
196 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,40 @@ | ||
use std::borrow::Cow; | ||
use std::path::{Path, PathBuf}; | ||
use std::path::PathBuf; | ||
|
||
use url::Url; | ||
|
||
use pep508_rs::VerbatimUrl; | ||
use requirements_txt::EditableRequirement; | ||
|
||
use crate::Verbatim; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct LocalEditable { | ||
pub requirement: EditableRequirement, | ||
/// The underlying [`EditableRequirement`] from the `requirements.txt` file. | ||
pub url: VerbatimUrl, | ||
/// Either the path to the editable or its checkout. | ||
pub path: PathBuf, | ||
} | ||
|
||
impl LocalEditable { | ||
/// Return the [`VerbatimUrl`] of the editable. | ||
/// Return the editable as a [`Url`]. | ||
pub fn url(&self) -> &VerbatimUrl { | ||
self.requirement.url() | ||
} | ||
|
||
/// Return the underlying [`Url`] of the editable. | ||
pub fn raw(&self) -> &Url { | ||
self.requirement.raw() | ||
&self.url | ||
} | ||
|
||
/// Return the resolved path to the editable. | ||
pub fn path(&self) -> &Path { | ||
&self.path | ||
pub fn raw(&self) -> &Url { | ||
self.url.raw() | ||
} | ||
} | ||
|
||
impl Verbatim for LocalEditable { | ||
fn verbatim(&self) -> Cow<'_, str> { | ||
self.url().verbatim() | ||
self.url.verbatim() | ||
} | ||
} | ||
|
||
impl std::fmt::Display for LocalEditable { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
self.requirement.fmt(f) | ||
std::fmt::Display::fmt(&self.url, f) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.