pub struct UniversalBuilder<T> { /* private fields */ }Expand description
Builder for UniversalClient with explicit control over cluster mode and credentials.
Unlike UniversalClient::open, the builder lets you force cluster mode
regardless of the number of addresses, and set ACL username/password
programmatically rather than embedding them in the URL.
§Examples
use redis_universal_client::UniversalBuilder;
// Force cluster mode with a single address
let client = UniversalBuilder::new(vec!["redis://127.0.0.1:7000".to_string()])
.cluster(true)
.build()?;
// Standalone Redis with ACL credentials
let client = UniversalBuilder::new(vec!["redis://127.0.0.1:6379".to_string()])
.username("alice")
.password("secret")
.build()?;Implementations§
Source§impl<T> UniversalBuilder<T>
impl<T> UniversalBuilder<T>
pub fn new(addrs: Vec<T>) -> UniversalBuilder<T>
pub fn cluster(self, flag: bool) -> UniversalBuilder<T>
Sourcepub fn username(self, username: impl Into<String>) -> UniversalBuilder<T>
pub fn username(self, username: impl Into<String>) -> UniversalBuilder<T>
Set the ACL username for authentication (Redis 6.0+).
Sourcepub fn password(self, password: impl Into<String>) -> UniversalBuilder<T>
pub fn password(self, password: impl Into<String>) -> UniversalBuilder<T>
Set the password for authentication.
pub fn build(self) -> RedisResult<UniversalClient>where
T: IntoConnectionInfo + Clone,
Auto Trait Implementations§
impl<T> Freeze for UniversalBuilder<T>
impl<T> RefUnwindSafe for UniversalBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for UniversalBuilder<T>where
T: Send,
impl<T> Sync for UniversalBuilder<T>where
T: Sync,
impl<T> Unpin for UniversalBuilder<T>where
T: Unpin,
impl<T> UnsafeUnpin for UniversalBuilder<T>
impl<T> UnwindSafe for UniversalBuilder<T>where
T: UnwindSafe,
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