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<String, Box<dyn Send + Fn(&Request, &HttpServer) -> Response>>,
not_found_handler: Box<dyn Send + Fn(&Request, &HttpServer) -> Response>,
delayed_index_update: usize,
credential_provider: Option<String>,
}
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<String, Box<dyn Send + Fn(&Request, &HttpServer) -> Response>>
API responders.
not_found_handler: Box<dyn Send + Fn(&Request, &HttpServer) -> Response>
Handler for 404 responses.
delayed_index_update: usize
If nonzero, the git index update to be delayed by the given number of seconds.
credential_provider: Option<String>
Credential provider in configuration
Implementations§
source§impl RegistryBuilder
impl RegistryBuilder
pub fn new() -> RegistryBuilder
sourcepub fn add_responder<R: 'static + Send + Fn(&Request, &HttpServer) -> Response>(
self,
url: impl Into<String>,
responder: R
) -> Self
pub fn add_responder<R: 'static + Send + Fn(&Request, &HttpServer) -> Response>( self, url: impl Into<String>, responder: R ) -> Self
Adds a custom HTTP response for a specific url
pub fn not_found_handler<R: 'static + Send + Fn(&Request, &HttpServer) -> Response>( self, responder: R ) -> Self
sourcepub fn delayed_index_update(self, delay: usize) -> Self
pub fn delayed_index_update(self, delay: usize) -> Self
Configures the git index update to be delayed by the given number of seconds.
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 credential_provider(self, provider: &[&str]) -> Self
pub fn credential_provider(self, provider: &[&str]) -> Self
The credential provider to configure for this registry.
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
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: 184 bytes