Struct rustdoc::html::url_parts_builder::UrlPartsBuilder
source · [−]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: StringImplementations
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");RunAdding more components afterward.
let mut builder = UrlPartsBuilder::singleton("core");
builder.push("str");
builder.push_front("nightly");
assert_eq!(builder.finish(), "nightly/core/str");RunPush a component onto the buffer, using format!’s formatting syntax.
Examples
Basic usage (equivalent to the example for UrlPartsBuilder::push):
let mut builder = UrlPartsBuilder::new();
builder.push("core");
builder.push("str");
builder.push_fmt(format_args!("{}.{}.html", "struct", "Bytes"));
assert_eq!(builder.finish(), "core/str/struct.Bytes.html");RunTrait Implementations
Extends a collection with the contents of an iterator. Read more
extend_one)Extends a collection with exactly one element.
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Extends a collection with the contents of an iterator. Read more
extend_one)Extends a collection with exactly one element.
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Creates a value from an iterator. Read more
Creates a value from an iterator. Read more
Auto Trait Implementations
impl RefUnwindSafe for UrlPartsBuilder
impl Send for UrlPartsBuilder
impl Sync for UrlPartsBuilder
impl Unpin for UrlPartsBuilder
impl UnwindSafe for UrlPartsBuilder
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
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