[−][src]Struct sibyl::Rows
Result set of a query
Methods
impl<'s> Rows<'s>
[src]
pub fn next(&self) -> Result<Option<Row>>
[src]
Returns the next row in the SELECT's result set.
Example
let stmt = conn.prepare(" SELECT street_address, postal_code, city, state_province FROM hr.locations WHERE country_id = :id ORDER BY location_id ")?; let rows = stmt.query(&[ &"CA" ])?; let mut res = Vec::new(); while let Some( row ) = rows.next()? { // &str does not live long enough to be useful for // the `street_address` let street_address : Option<String> = row.get(0)?; let postal_code : Option<&str> = row.get(1)?; let city : Option<&str> = row.get(2)?; let state_province : Option<&str> = row.get(3)?; let city_address = format!("{} {} {}", city .unwrap_or_default(), state_province .unwrap_or_default(), postal_code .unwrap_or_default(), ); res.push((street_address.unwrap_or_default(), city_address)); } assert_eq!(2, res.len()); assert_eq!("Toronto Ontario M5V 2L7", res[0].1); assert_eq!("Whitehorse Yukon YSW 9T2", res[1].1);
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,