-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Represent a package in Proc Macro Server more reliably
- Loading branch information
1 parent
bf30ab7
commit 2946b39
Showing
10 changed files
with
58 additions
and
27 deletions.
There are no files selected for viewing
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
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,8 +1,26 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// Representation of the Scarb package. | ||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Hash)] | ||
pub struct Package { | ||
/// Name of the Compilation Unit associated with the package. | ||
pub name: String, | ||
/// A string-serialized `PackageId` from the Scarb workspace | ||
pub id: String, | ||
} | ||
|
||
impl Package { | ||
pub fn new(name: impl AsRef<str>, id: impl AsRef<str>) -> Self { | ||
Self { | ||
name: name.as_ref().to_string(), | ||
id: id.as_ref().to_string(), | ||
} | ||
} | ||
} | ||
|
||
/// A description of the location in the workspace where particular macro is available. | ||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Hash)] | ||
pub struct ProcMacroScope { | ||
/// Serialized `PackageId` of the package in which context the action occurs. | ||
pub package_id: String, | ||
pub package: Package, | ||
} |
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