pub struct NatsServerBuilder { /* private fields */ }Expand description
Configuration for a NatsServer
Obtained from NatsServer::builder.
Implementations§
Source§impl NatsServerBuilder
impl NatsServerBuilder
Sourcepub fn jetstream(self) -> Self
pub fn jetstream(self) -> Self
Enable JetStream, storing data in the server’s temporary directory
Sourcepub fn jetstream_domain(self, domain: impl Into<String>) -> Self
pub fn jetstream_domain(self, domain: impl Into<String>) -> Self
Enable JetStream under the given domain
Sourcepub fn user(
self,
username: impl Into<String>,
password: impl Into<String>,
) -> Self
pub fn user( self, username: impl Into<String>, password: impl Into<String>, ) -> Self
Require clients to authenticate, allowing username with password
Can be called multiple times to allow multiple users.
Sourcepub fn max_payload(self, max_payload: u32) -> Self
pub fn max_payload(self, max_payload: u32) -> Self
Set the maximum payload size accepted by the server
Sourcepub fn config(self, config: impl Into<String>) -> Self
pub fn config(self, config: impl Into<String>) -> Self
Append raw lines to the generated server configuration file
Sourcepub async fn start(self) -> Option<NatsServer>
pub async fn start(self) -> Option<NatsServer>
Start the server, waiting until it’s ready to accept clients
Returns None if no nats-server binary could be found
and the CI environment variable isn’t set.
§Panics
Panics if the binary is missing while running in CI, or if the server fails to start.
Trait Implementations§
Source§impl Debug for NatsServerBuilder
impl Debug for NatsServerBuilder
Auto Trait Implementations§
impl Freeze for NatsServerBuilder
impl RefUnwindSafe for NatsServerBuilder
impl Send for NatsServerBuilder
impl Sync for NatsServerBuilder
impl Unpin for NatsServerBuilder
impl UnsafeUnpin for NatsServerBuilder
impl UnwindSafe for NatsServerBuilder
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
Mutably borrows from an owned value. Read more