pub struct ResultRowRef<'a> { /* private fields */ }
Expand description
A reference to a Row
in a ResultSet
. The columns can be accessed either
through their position or using the column name.
let names = vec!["id".to_string(), "name".to_string()];
let rows = vec![vec!["1234".into(), "Musti".into()]];
let result_set = ResultSet::new(names, rows);
let row = result_set.first().unwrap();
assert_eq!(row[0], row["id"]);
assert_eq!(row[1], row["name"]);
Implementations§
Source§impl<'a> ResultRowRef<'a>
impl<'a> ResultRowRef<'a>
Sourcepub fn at(&self, i: usize) -> Option<&ParameterizedValue<'static>>
pub fn at(&self, i: usize) -> Option<&ParameterizedValue<'static>>
Take a value from a certain position in the row, if having a value in that position.
assert_eq!(Some(&row[0]), row.at(0));
Sourcepub fn get(&self, name: &str) -> Option<&ParameterizedValue<'static>>
pub fn get(&self, name: &str) -> Option<&ParameterizedValue<'static>>
Take a value with the given column name from the row.
assert_eq!(Some(&row["id"]), row.get("id"));
Trait Implementations§
Source§impl<'a> Debug for ResultRowRef<'a>
impl<'a> Debug for ResultRowRef<'a>
Source§impl<'a, I: ValueIndex<ResultRowRef<'a>, ParameterizedValue<'static>> + 'static> Index<I> for ResultRowRef<'a>
impl<'a, I: ValueIndex<ResultRowRef<'a>, ParameterizedValue<'static>> + 'static> Index<I> for ResultRowRef<'a>
Source§type Output = ParameterizedValue<'static>
type Output = ParameterizedValue<'static>
The returned type after indexing.
Source§fn index(&self, index: I) -> &ParameterizedValue<'static>
fn index(&self, index: I) -> &ParameterizedValue<'static>
Performs the indexing (
container[index]
) operation. Read moreimpl ValueIndex<ResultRowRef<'_>, ParameterizedValue<'static>> for &str
impl ValueIndex<ResultRowRef<'_>, ParameterizedValue<'static>> for usize
Auto Trait Implementations§
impl<'a> Freeze for ResultRowRef<'a>
impl<'a> RefUnwindSafe for ResultRowRef<'a>
impl<'a> Send for ResultRowRef<'a>
impl<'a> Sync for ResultRowRef<'a>
impl<'a> Unpin for ResultRowRef<'a>
impl<'a> UnwindSafe for ResultRowRef<'a>
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