-
Notifications
You must be signed in to change notification settings - Fork 499
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
Showing
25 changed files
with
510 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use cairo_lang_defs::db::DefsGroup; | ||
use cairo_lang_defs::diagnostic_utils::StableLocation; | ||
use cairo_lang_defs::ids::{LanguageElementId, LookupItemId, MemberId, VariantId}; | ||
|
||
/// Item which documentation can be fetched from source code. | ||
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] | ||
pub enum DocumentableItemId { | ||
LookupItem(LookupItemId), | ||
Member(MemberId), | ||
Variant(VariantId), | ||
} | ||
|
||
impl DocumentableItemId { | ||
pub fn stable_location(&self, db: &dyn DefsGroup) -> StableLocation { | ||
match self { | ||
DocumentableItemId::LookupItem(lookup_item_id) => lookup_item_id.stable_location(db), | ||
DocumentableItemId::Member(member_id) => member_id.stable_location(db), | ||
DocumentableItemId::Variant(variant_id) => variant_id.stable_location(db), | ||
} | ||
} | ||
} | ||
|
||
impl From<LookupItemId> for DocumentableItemId { | ||
fn from(value: LookupItemId) -> Self { | ||
DocumentableItemId::LookupItem(value) | ||
} | ||
} | ||
|
||
impl From<MemberId> for DocumentableItemId { | ||
fn from(value: MemberId) -> Self { | ||
DocumentableItemId::Member(value) | ||
} | ||
} | ||
impl From<VariantId> for DocumentableItemId { | ||
fn from(value: VariantId) -> Self { | ||
DocumentableItemId::Variant(value) | ||
} | ||
} |
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,2 +1,3 @@ | ||
pub mod db; | ||
pub mod documentable_item; | ||
mod markdown; |
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.