pub struct Client { /* private fields */ }Expand description
The client for mise One instance of this will keep one connection open to the server and it will be closed once this instance is deallocated.
It is possible to batch requests with the plural methods (ex gets instead of get).
Implementations§
Source§impl Client
impl Client
Sourcepub fn connect(addr: SocketAddr) -> Result<Self, ClientError>
pub fn connect(addr: SocketAddr) -> Result<Self, ClientError>
Creates a new client by connecting to a server. Every client instance is one connection.
§Errors
Errors if connection cannot be established.
Sourcepub fn gets<const X: usize>(
&mut self,
uris: &[&str; X],
) -> Result<[Option<Result<Value, ClientError>>; X], ClientError>
pub fn gets<const X: usize>( &mut self, uris: &[&str; X], ) -> Result<[Option<Result<Value, ClientError>>; X], ClientError>
Sends a batch of GET requests sent all at once.
First writes all the requests in the pipe before starting to read back the first response. Effectively this is a batching mode since there is no waiting between sends.
When batching, consider that if the send buffer is full this may block undefinetly as it won’t read the first response until all requests are sent first. This means that the batch number cannot be arbitrarly high but there is a virtual limit that will trigger this behavior and then rend this method stuck in wait mode while trying to write to a full buffer.
§Errors
Errors if request fails