Was this page helpful?
Caution
You're viewing documentation for a deprecated version of Scylla Rust Driver. Switch to the latest stable version.
Inet
is represented as std::net::IpAddr
use scylla::IntoTypedRows;
use std::net::{IpAddr, Ipv4Addr};
// Insert some ip address into the table
let to_insert: IpAddr = IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1));;
session
.query("INSERT INTO keyspace.table (a) VALUES(?)", (to_insert,))
.await?;
// Read inet from the table
let result = session.query("SELECT a FROM keyspace.table", &[]).await?;
let mut iter = result.rows_typed::<(IpAddr,)>()?;
while let Some((inet_value,)) = iter.next().transpose()? {
println!("{:?}", inet_value);
}
Was this page helpful?