pub struct VecBuilder<T> where
    T: Clone
{ /* private fields */ }
Expand description

List of T, a straightforward type, being built as part of the configuration

The default is the empty list.

Example

use derive_builder::Builder;
use serde::{Deserialize, Serialize};
use tor_config::{ConfigBuildError};
use tor_config::{define_list_builder_accessors, list_builder::VecBuilder};
use std::net::SocketAddr;

#[derive(Debug, Clone, Builder)]
#[builder(build_fn(error = "ConfigBuildError"))]
#[builder(derive(Debug, Serialize, Deserialize))]
pub struct FallbackDir {
    #[builder(sub_builder(fn_name = "build"), setter(custom))]
    orports: Vec<SocketAddr>,
}

define_list_builder_accessors! {
    struct FallbackDirBuilder {
        pub orports: [SocketAddr],
    }
}

let mut bld = FallbackDirBuilder::default();
bld.orports().push("[2001:db8:0::42]:12".parse().unwrap());
assert_eq!( bld.build().unwrap().orports[0].to_string(),
            "[2001:db8::42]:12" );

Wrapper struct to help derive_builder find the right types and methods

This struct is not part of the configuration API. Refer to the containing structures for information on how to build the config.

Implementations

Resolve this list to a list of built items.

If the value is still the Default, a built-in default list will be built and returned; otherwise each applicable item will be built, and the results collected into a single built list.

Resolve the list to the default if necessary and then return &mut Vec

Resolve the list to the default if necessary and then return &mut Vec

Resolve the list to the default if necessary and then return &mut Vec

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. 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

Returns the argument unchanged.

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

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

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

Uses borrowed data to replace owned data, usually by cloning. Read more

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