pub struct GitHubPermalink {
pub owner: String,
pub repo: String,
pub commit: String,
pub path: String,
pub line_range: Option<LineRange>,
}Expand description
A parsed GitHub permalink.
Fields§
§owner: StringRepository owner.
repo: StringRepository name.
commit: StringCommit SHA.
path: StringFile path within the repository.
line_range: Option<LineRange>Optional line range specification.
Implementations§
Source§impl GitHubPermalink
impl GitHubPermalink
Sourcepub fn parse_all(text: &str) -> Vec<GitHubPermalink>
pub fn parse_all(text: &str) -> Vec<GitHubPermalink>
Parses all GitHub permalink URLs from the given text.
Only matches URLs with a commit SHA (not branch names), ensuring only true permalinks are expanded.
Note: Duplicate URLs are ignored, and a maximum of 3 links are returned.
Sourcepub async fn fetch(
&self,
http_client: &Client,
) -> Result<ExpandedContent, ExpandError>
pub async fn fetch( &self, http_client: &Client, ) -> Result<ExpandedContent, ExpandError>
Fetches the raw file content from GitHub and returns a code block.
Sourcefn build_code_block(&self, body: &str, max_lines: usize) -> ExpandedContent
fn build_code_block(&self, body: &str, max_lines: usize) -> ExpandedContent
Builds an ExpandedContent::CodeBlock from raw file content.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GitHubPermalink
impl RefUnwindSafe for GitHubPermalink
impl Send for GitHubPermalink
impl Sync for GitHubPermalink
impl Unpin for GitHubPermalink
impl UnsafeUnpin for GitHubPermalink
impl UnwindSafe for GitHubPermalink
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more