pub struct Row { /* private fields */ }Expand description
A row of a result.
The rows of one result share one buffer, so a Row is cheap to keep and
to clone.
Implementations§
Source§impl Row
impl Row
Sourcepub fn get<'a, T: FromSql<'a>>(
&'a self,
column: impl RowIndex,
) -> Result<T, Error>
pub fn get<'a, T: FromSql<'a>>( &'a self, column: impl RowIndex, ) -> Result<T, Error>
Reads a column, by name or by position (from 0), as T.
let row = client.query_one("SELECT id, email FROM users WHERE id = $1", &[&7i64]).await?;
let id: i64 = row.get("id")?;
let email: &str = row.get(1)?;The error names the column and says what it can be read as when the
type does not fit, or that the value is NULL and needs an Option.
Trait Implementations§
Auto Trait Implementations§
impl !Send for Row
impl !Sync for Row
impl Forget for Row
impl Freeze for Row
impl Move for Row
impl RefUnwindSafe for Row
impl Unpin for Row
impl UnsafeUnpin for Row
impl UnwindSafe for Row
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more