pub fn connect<'a, C: Clock>(
        &'a mut self,
        network: &'a mut N,
        clock: Option<&'a C>,
    ) -> Result<Client<'a, N, C, P>, ConnectionError> {
        // Previous socket is maybe faulty, so we are closing it here
        if self.auth_failed {
            self.disconnect(network);
        }

        // Check if cached socket is still connected
        self.test_socket(network, clock);

        // Reuse existing connection
        if self.socket.is_some() {
            return Ok(self.create_client(network, clock));
        }

        self.new_client(network, clock)
    }
/// Returns a Redis client. Caches the connection for future reuse.
/// The client has the same lifetime as the network reference.
///
/// As the connection is cached, later calls are cheap.
/// So a new client may be created when switching threads, RISC tasks, etc.
///
/// *Authentication*
/// Authentication is done automatically when creating a new connection. So the caller can
/// expect a already authenticated and read2use client
///
/// # Arguments
///
/// * `network`: Mutable borrow of embedded-nal network stack
/// * `clock`: Borrow of embedded-time clock
///
/// returns: Result<Client<N, C, P>, ConnectionError>
Returns a Redis client. Caches the connection for future reuse.
The client has the same lifetime as the network reference.

As the connection is cached, later calls are cheap.
So a new client may be created when switching threads, RISC tasks, etc.

Authentication
Authentication is done automatically when creating a new connection. So the caller can
expect a already authenticated and read2use client
Returns a Redis client . Caches the connection for future reuse . The client has the same lifetime as the network reference . As the connection is cached later calls are cheap . So a new client may be created when switching threads RISC tasks etc . Authentication Authentication is done automatically when creating a new connection . So the caller can expect a already authenticated and read2use client
pub fn connect<'a, C: Clock>(
        &'a mut self,
        network: &'a mut N,
        clock: Option<&'a C>,
    ) -> Result<Client<'a, N, C, P>, ConnectionError> {
        // Previous socket is maybe faulty, so we are closing it here
        if self.auth_failed {
            self.disconnect(network);
        }
        // Check if cached socket is still connected
        self.test_socket(network, clock);
        // Reuse existing connection
        if self.socket.is_some() {
            return Ok(self.create_client(network, clock));
        }
        self.new_client(network, clock)
    }
pub fn connect < ' a , C : Clock > ( & ' a mut self , network : & ' a mut N , clock : Option < & ' a C > , ) -> Result < Client < ' a , N , C , P > , ConnectionError > { // Previous socket is maybe faulty, so we are closing it here if self . auth_failed { self . disconnect ( network ) ; } // Check if cached socket is still connected self . test_socket ( network , clock ) ; // Reuse existing connection if self . socket . is_some ( ) { return Ok ( self . create_client ( network , clock ) ) ; } self . new_client ( network , clock ) }
Returns a Redis client.
Returns a Redis client .
&'a mut self
network
&'a mut N
clock
Option<&'a C>
&'a mut self
network
&'a mut N
clock
Option<&'a C>