pub enum NatsAuth {
Anonymous,
CredentialsFile(PathBuf),
NKeySeed(String),
UserPassword {
user: String,
password: String,
},
}Expand description
How a component authenticates to NATS: NATS_CREDS_FILE (a .creds
file), NATS_NKEY_SEED, or NATS_USER with NATS_PASSWORD; at most one.
Without any the connection is anonymous, as before.
Variants§
Implementations§
Source§impl NatsAuth
impl NatsAuth
pub fn from_env() -> Result<NatsAuth, Report>
Sourcepub fn from_vars(
vars: impl Fn(&str) -> Option<String>,
) -> Result<NatsAuth, Report>
pub fn from_vars( vars: impl Fn(&str) -> Option<String>, ) -> Result<NatsAuth, Report>
The credentials the variables vars give; an empty one counts as
unset.
Sourcepub async fn apply(
&self,
options: ConnectOptions,
) -> Result<ConnectOptions, Report>
pub async fn apply( &self, options: ConnectOptions, ) -> Result<ConnectOptions, Report>
options carrying these credentials.
Trait Implementations§
impl Eq for NatsAuth
impl StructuralPartialEq for NatsAuth
Auto Trait Implementations§
impl Freeze for NatsAuth
impl RefUnwindSafe for NatsAuth
impl Send for NatsAuth
impl Sync for NatsAuth
impl Unpin for NatsAuth
impl UnsafeUnpin for NatsAuth
impl UnwindSafe for NatsAuth
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