pub struct Row { /* private fields */ }
Expand description
Client side representation of a MySql row.
It allows you to move column values out of a row with Row::take
method but note that it
makes row incomplete. Calls to from_row_opt
on incomplete row will return
Error::FromRowError
and also numerical indexing on taken columns will panic.
Implementations§
source§impl Row
impl Row
sourcepub fn as_ref(&self, index: usize) -> Option<&Value>
pub fn as_ref(&self, index: usize) -> Option<&Value>
Returns reference to the value of a column with index index
if it exists and wasn’t taken
by Row::take
method.
Non panicking version of row[usize]
.
sourcepub fn get<T, I>(&self, index: I) -> Option<T>where
T: FromValue,
I: ColumnIndex,
pub fn get<T, I>(&self, index: I) -> Option<T>where
T: FromValue,
I: ColumnIndex,
Will copy value at index index
if it was not taken by Row::take
earlier,
then will convert it to T
.
sourcepub fn get_opt<T, I>(&self, index: I) -> Option<Result<T, FromValueError>>where
T: FromValue,
I: ColumnIndex,
pub fn get_opt<T, I>(&self, index: I) -> Option<Result<T, FromValueError>>where
T: FromValue,
I: ColumnIndex,
Will copy value at index index
if it was not taken by Row::take
or Row::take_opt
earlier, then will attempt convert it to T
. Unlike Row::get
, Row::get_opt
will
allow you to directly handle errors if the value could not be converted to T
.
sourcepub fn take<T, I>(&mut self, index: I) -> Option<T>where
T: FromValue,
I: ColumnIndex,
pub fn take<T, I>(&mut self, index: I) -> Option<T>where
T: FromValue,
I: ColumnIndex,
Will take value of a column with index index
if it exists and wasn’t taken earlier then
will converts it to T
.
sourcepub fn take_opt<T, I>(&mut self, index: I) -> Option<Result<T, FromValueError>>where
T: FromValue,
I: ColumnIndex,
pub fn take_opt<T, I>(&mut self, index: I) -> Option<Result<T, FromValueError>>where
T: FromValue,
I: ColumnIndex,
Will take value of a column with index index
if it exists and wasn’t taken earlier then
will attempt to convert it to T
. Unlike Row::take
, Row::take_opt
will allow you to
directly handle errors if the value could not be converted to T
.