Skip to main content

block_for_result

Function block_for_result 

Source
pub fn block_for_result(
    res: &Receiver<VoltTable>,
) -> Result<VoltTable, VoltError>
Expand description

Blocks until a response is received and converts any VoltDB errors.

This is a convenience function for synchronous usage. It waits for the response on the channel and converts VoltDB-level errors (from the response) into VoltError.

§Arguments

  • res - The receiver from a query or stored procedure call

§Returns

The result VoltTable on success, or VoltError if the operation failed.

§Example

use voltdb_client_rust::{Node, NodeOpt, IpPort, block_for_result};

let node = Node::new(opt)?;
let rx = node.query("SELECT * FROM users")?;
let mut table = block_for_result(&rx)?;

while table.advance_row() {
    // Process rows...
}