Struct cargo_test_support::registry::RegistryBuilder
source · pub struct RegistryBuilder {
alternative: Option<String>,
token: Option<Token>,
auth_required: bool,
http_index: bool,
http_api: bool,
api: bool,
configure_token: bool,
configure_registry: bool,
custom_responders: HashMap<&'static str, Box<dyn Send + Fn(&Request, &HttpServer) -> Response>>,
}
Expand description
A builder for initializing registries.
Fields§
§alternative: Option<String>
If set, configures an alternate registry with the given name.
token: Option<Token>
The authorization token for the registry.
auth_required: bool
If set, the registry requires authorization for all operations.
http_index: bool
If set, serves the index over http.
http_api: bool
If set, serves the API over http.
api: bool
If set, config.json includes ‘api’
configure_token: bool
Write the token in the configuration.
configure_registry: bool
Write the registry in configuration.
custom_responders: HashMap<&'static str, Box<dyn Send + Fn(&Request, &HttpServer) -> Response>>
API responders.
Implementations§
source§impl RegistryBuilder
impl RegistryBuilder
pub fn new() -> RegistryBuilder
sourcepub fn add_responder<R: 'static + Send + Fn(&Request, &HttpServer) -> Response>(
self,
url: &'static str,
responder: R
) -> Self
pub fn add_responder<R: 'static + Send + Fn(&Request, &HttpServer) -> Response>( self, url: &'static str, responder: R ) -> Self
Adds a custom HTTP response for a specific url
sourcepub fn alternative_named(self, alt: &str) -> Self
pub fn alternative_named(self, alt: &str) -> Self
Sets whether or not to initialize as an alternative registry.
sourcepub fn alternative(self) -> Self
pub fn alternative(self) -> Self
Sets whether or not to initialize as an alternative registry.
sourcepub fn no_configure_token(self) -> Self
pub fn no_configure_token(self) -> Self
Prevents placing a token in the configuration
sourcepub fn no_configure_registry(self) -> Self
pub fn no_configure_registry(self) -> Self
Prevents adding the registry to the configuration.
sourcepub fn auth_required(self) -> Self
pub fn auth_required(self) -> Self
Sets this registry to require the authentication token for all operations.
sourcepub fn http_index(self) -> Self
pub fn http_index(self) -> Self
Operate the index over http
sourcepub fn build(self) -> TestRegistry
pub fn build(self) -> TestRegistry
Initializes the registry.
Auto Trait Implementations§
impl !RefUnwindSafe for RegistryBuilder
impl Send for RegistryBuilder
impl !Sync for RegistryBuilder
impl Unpin for RegistryBuilder
impl !UnwindSafe for RegistryBuilder
Blanket Implementations§
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: 136 bytes