Skip to main content

Module report

Module report 

Source
Expand description

Report a problem: the new-issue URL help.report opens, prefilled with what a maintainer asks first (the version info, the platform, the page shown, the last inspect pick). An idea (help.suggest, Report::idea_url) carries its title and the page alone.

The URL follows GitHub’s query parameters: title and body, or, with an issue form (template=bug.yml), one parameter per form field, named by the field’s id (FIELD_VERSION, FIELD_PLATFORM, FIELD_PAGE, FIELD_PICK). It is kept under URL_LIMIT bytes: the pick is trimmed first, then the page, each ending (trimmed).

use egui_pop_api::about::report::{Report, URL_LIMIT};

let report = Report {
    title: "Problem in Files".into(),
    version: "Darkroom 1.2.0\negui-pop 0.3.0\n".into(),
    platform: "linux x86_64".into(),
    page: Some("Files".into()),
    pick: None,
};
let url = report.url("https://github.com/o/r/issues", Some("bug.yml"));
assert!(url.url.starts_with("https://github.com/o/r/issues/new?template=bug.yml&title=Problem%20in%20Files&"));
assert!(url.url.len() <= URL_LIMIT && !url.trimmed);

Structs§

IssueUrl
A new-issue URL, and whether a field was trimmed to fit.
Report
What a report says before the reporter writes a word.

Constants§

FIELD_PAGE
FIELD_PICK
FIELD_PLATFORM
FIELD_VERSION
The issue form fields the URL fills, by id (the repository’s form declares them; .github/ISSUE_TEMPLATE/bug.yml in egui-pop’s).
TRIMMED
What ends a trimmed field.
URL_LIMIT
The longest URL built, in bytes: GitHub answers 414 a little over 8 KB.

Functions§

describe_user_agent
A browser and its operating system, read from a user agent string (Firefox 132 on Linux); the string itself when neither is known.
encode
Percent-encodes a query value: everything but the unreserved characters (RFC 3986), as UTF-8 bytes.