pub struct Response<E: EntityKind>(pub Vec<(Key, E)>);Expand description
Response
Tuple Fields§
§0: Vec<(Key, E)>Implementations§
Source§impl<E> Response<E>where
E: EntityKind,
impl<E> Response<E>where
E: EntityKind,
Sourcepub fn try_key(&self) -> Result<Key, Error>
pub fn try_key(&self) -> Result<Key, Error>
Return the first key or an error if no rows were returned.
Sourcepub fn pk(&self) -> Option<E::PrimaryKey>
pub fn pk(&self) -> Option<E::PrimaryKey>
Pk
First primary key in the response, if present.
Sourcepub fn try_pk(&self) -> Result<E::PrimaryKey, Error>
pub fn try_pk(&self) -> Result<E::PrimaryKey, Error>
Return the first primary key or an error if no rows were returned.
Sourcepub fn pks(&self) -> Vec<E::PrimaryKey>
pub fn pks(&self) -> Vec<E::PrimaryKey>
Collect all primary keys in order.
Sourcepub fn pks_iter(self) -> impl Iterator<Item = E::PrimaryKey>
pub fn pks_iter(self) -> impl Iterator<Item = E::PrimaryKey>
Iterate primary keys without cloning entities.
Sourcepub fn try_entity(self) -> Result<E, Error>
pub fn try_entity(self) -> Result<E, Error>
Return the first entity or an error if no rows were returned.
Sourcepub fn entities_iter(self) -> impl Iterator<Item = E>
pub fn entities_iter(self) -> impl Iterator<Item = E>
Iterate entities without materializing a Vec.
Sourcepub fn try_view(self) -> Result<E::ViewType, Error>
pub fn try_view(self) -> Result<E::ViewType, Error>
Convert the first entity to its view type or error if empty.
Sourcepub fn views(self) -> Vec<E::ViewType>
pub fn views(self) -> Vec<E::ViewType>
Convert all entities to their view types and collect them.
Sourcepub fn views_iter(self) -> impl Iterator<Item = E::ViewType>
pub fn views_iter(self) -> impl Iterator<Item = E::ViewType>
Iterate over view types without cloning entities.
Trait Implementations§
Source§impl<E: EntityKind> IntoIterator for Response<E>
impl<E: EntityKind> IntoIterator for Response<E>
Auto Trait Implementations§
impl<E> Freeze for Response<E>
impl<E> RefUnwindSafe for Response<E>where
E: RefUnwindSafe,
impl<E> Send for Response<E>where
E: Send,
impl<E> Sync for Response<E>where
E: Sync,
impl<E> Unpin for Response<E>where
E: Unpin,
impl<E> UnwindSafe for Response<E>where
E: UnwindSafe,
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