Struct rustdoc::html::url_parts_builder::UrlPartsBuilder[−][src]

pub(crate) struct UrlPartsBuilder {
    buf: String,
}
Expand description

A builder that allows efficiently and easily constructing the part of a URL after the domain: nightly/core/str/struct.Bytes.html.

This type is a wrapper around the final String buffer, but its API is like that of a Vec of URL components.

Fields

buf: String

Implementations

Create an empty buffer.

Create an empty buffer with capacity for the specified number of bytes.

Create a buffer with one URL component.

Examples

Basic usage:

ⓘ
let builder = UrlPartsBuilder::singleton("core");
assert_eq!(builder.finish(), "core");
Run

Adding more components afterward.

ⓘ
let mut builder = UrlPartsBuilder::singleton("core");
builder.push("str");
builder.push_front("nightly");
assert_eq!(builder.finish(), "nightly/core/str");
Run

Push a component onto the buffer.

Examples

Basic usage:

ⓘ
let mut builder = UrlPartsBuilder::new();
builder.push("core");
builder.push("str");
builder.push("struct.Bytes.html");
assert_eq!(builder.finish(), "core/str/struct.Bytes.html");
Run

Push a component onto the front of the buffer.

Examples

Basic usage:

ⓘ
let mut builder = UrlPartsBuilder::new();
builder.push("core");
builder.push("str");
builder.push_front("nightly");
builder.push("struct.Bytes.html");
assert_eq!(builder.finish(), "nightly/core/str/struct.Bytes.html");
Run

Get the final String buffer.

Trait Implementations

Formats the value using the given formatter. Read more

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Creates a value from an iterator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

Layout

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 24 bytes