Struct Issue

Source
pub struct Issue<'a> { /* private fields */ }
Expand description

GitHub issue struct with support for every field available.

This struct is holds repository, username or organization name and fields to prefill when opening the issue url.

§Example

use github_issue_url::Issue;

const GITHUB_ISSUE_LINK: &str = "https://github.com/EstebanBorai/github-issue-url/issues/new?title=Null%3A+The+Billion+Dollar+Mistake&body=Null+is+a+flag.+It+represents+different+situations+depending+on+the+context+in+which+it+is+used+and+invoked.+This+yields+the+most+serious+error+in+software+development%3A+Coupling+a+hidden+decision+in+the+contract+between+an+object+and+who+uses+it.&template=bug_report.md&labels=bug%2Cproduction%2Chigh-severity&assignee=EstebanBorai&milestone=1&projects=1";
const SAMPLE_ISSUE_BODY: &str = r#"Null is a flag. It represents different situations depending on the context in which it is used and invoked. This yields the most serious error in software development: Coupling a hidden decision in the contract between an object and who uses it."#;

let mut have = Issue::new("github-issue-url", "EstebanBorai").unwrap();

have.title("Null: The Billion Dollar Mistake");
have.body(SAMPLE_ISSUE_BODY);
have.template("bug_report.md");
have.labels("bug,production,high-severity");
have.assignee("EstebanBorai");
have.milestone("1");
have.projects("1");
let have = have.url().unwrap();

assert_eq!(have, GITHUB_ISSUE_LINK.to_string());

Implementations§

Source§

impl<'a> Issue<'a>

GitHub Issue including the repository name and the repository owner username.

Issue fields are kept in a Vec<(&'a str, &'a str)> for easy parsing when parsing the URL with query params.

Every optional param is specified using the setter methods.

Source

pub fn new(repository_name: &'a str, repository_owner: &'a str) -> Result<Self>

Source

pub fn assignee(&mut self, assignee: &'a str)

The username of the issue’s assignee.

The issue author requires write access to the repository in order to use this feature

Source

pub fn body(&mut self, body: &'a str)

Prefilled issue body content

Source

pub fn labels(&mut self, labels: &'a str)

Issue labels separated by comma (,). Example: bug,production,high-severity

The issue author requires write access to the repository in order to use this feature

Source

pub fn milestone(&mut self, milestone: &'a str)

The ID (number) of the milestone linked to this issue.

The milestone ID can be found in the Issues/Milestone section.

https://github.com///milestone/

The issue author requires write access to the repository in order to use this feature

Source

pub fn projects(&mut self, projects: &'a str)

The IDs (number) of the projects to link this issue to separated by comma (,).

Projects IDs are found in the repository session.

https://github.com///projects/

The issue author requires write access to the repository in order to use this feature

Source

pub fn title(&mut self, title: &'a str)

Prefilled issue title

Source

pub fn template(&mut self, template: &'a str)

The name of the issue template to use when opening the final link. An issue template lives in .github/ISSUE_TEMPLATE/.md, if the template you want to use when opening this link is ISSUE_TEMPLATE/bugs.md the value for Issue.template must be bugs.md

Source

pub fn url(&'a self) -> Result<String>

Trait Implementations§

Source§

impl<'a> Debug for Issue<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> PartialEq for Issue<'a>

Source§

fn eq(&self, other: &Issue<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Eq for Issue<'a>

Source§

impl<'a> StructuralPartialEq for Issue<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Issue<'a>

§

impl<'a> RefUnwindSafe for Issue<'a>

§

impl<'a> Send for Issue<'a>

§

impl<'a> Sync for Issue<'a>

§

impl<'a> Unpin for Issue<'a>

§

impl<'a> UnwindSafe for Issue<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,