pub struct Github<'a> {
pub owner: &'a str,
pub repo: &'a str,
pub branch: &'a str,
pub path: &'a str,
pub file: &'a str,
pub url: String,
}Expand description
The Github repository and the Url to the files in the repository.
Fields§
§owner: &'a str§repo: &'a str§branch: &'a str§path: &'a str§file: &'a str§url: StringImplementations§
source§impl<'a> Github<'a>
impl<'a> Github<'a>
sourcepub fn set_fields(
&mut self,
owner: &'a str,
repo: &'a str,
branch: &'a str,
path: &'a str,
file: &'a str,
)
pub fn set_fields( &mut self, owner: &'a str, repo: &'a str, branch: &'a str, path: &'a str, file: &'a str, )
This sets the fields of the Github instance.
The fields need to be set in order to create a valid Url when using Github::build_url or Github::build_image_url
§Usage
let mut github_repo = Github::new();
github_repo.set_fields("OneilNvM", "rl-hours-tracker", "master", "src", "main.rs");sourcepub fn build_url(&mut self)
pub fn build_url(&mut self)
Builds the Url for the raw contents of a file.
This function should only be used for files on Github which can be opened in raw format.
Fields need to be set first through Github::set_fields.
§Usage
let mut github_repo = Github::new();
github_repo.set_fields(owner, repo, branch, path, file);
// Example Output: "https://raw.githubusercontent.com/OneilNvM/rl-hours-tracker/refs/heads/master/src/main.rs"
github_repo.build_url();sourcepub fn build_image_url(&mut self)
pub fn build_image_url(&mut self)
Builds the Url for the blob of an image file.
This function should only be used for image files in a Github repository.
Fields need to be set first through Github::set_fields.
§Usage
let mut github_repo = Github::new();
github_repo.set_fields(owner, repo, branch, path, file);
// Example Output: "https://github.com/OneilNvM/rl-hours-tracker/blob/master/images/img.png"
github_repo.build_image_url();Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Github<'a>
impl<'a> RefUnwindSafe for Github<'a>
impl<'a> Send for Github<'a>
impl<'a> Sync for Github<'a>
impl<'a> Unpin for Github<'a>
impl<'a> UnwindSafe for Github<'a>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more