Skip to content

Use string literals instead of manual Url construction in examples #293

@yoshuawuyts

Description

@yoshuawuyts

url v2.2.0 has been released which includes a TryFrom<str> for Url impl, which means we can use string literals in our Url examples.

// current
let url = Url::parse("https://github.com/foob").unwrap();
let req = Request::new(url);

// proposed
let req = Request::new("https://github.com/foob");

Both variants will continue to work, and the former case is useful for when dealing with untrusted input. But at least now it should be easier to write examples using Request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions