Skip to main content

Response

Struct Response 

Source
pub struct Response<E: EntityKind> { /* private fields */ }
Expand description

Response

Public facade over a materialized query result. Wraps the core response and exposes only safe, policy-aware operations. Any returned Id<E> values are public identifiers for correlation, reporting, and lookup only.

Implementations§

Source§

impl<E: EntityKind> Response<E>

Source

pub const fn from_core(inner: CoreEntityResponse<E>) -> Self

Construct a facade response from a core response.

Source

pub const fn count(&self) -> u32

Source

pub const fn exists(&self) -> bool

Source

pub fn require_one(&self) -> Result<(), Error>

Require exactly one row.

Source

pub fn require_some(&self) -> Result<(), Error>

Require at least one row.

Source

pub fn entity(self) -> Result<E, Error>

Return the single entity.

Source

pub fn try_entity(self) -> Result<Option<E>, Error>

Return zero or one entity.

Source

pub fn entities(self) -> Vec<E>

Return all entities.

Source

pub fn require_id(self) -> Result<Id<E>, Error>

Return the single identity.

This key is a public identifier and does not grant access or authority.

Source

pub fn try_id(self) -> Result<Option<Id<E>>, Error>

Return zero or one primary key.

IDs are safe to transport and log; verification is always explicit and contextual.

Source

pub fn ids(&self) -> impl Iterator<Item = Id<E>> + '_

Borrow an iterator over primary keys for correlation, reporting, and lookup.

Source

pub fn contains_id(&self, id: &Id<E>) -> bool

Check whether the response contains the given primary key.

Trait Implementations§

Source§

impl<E: Debug + EntityKind> Debug for Response<E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<E> Freeze for Response<E>

§

impl<E> RefUnwindSafe for Response<E>

§

impl<E> Send for Response<E>
where E: Send, <E as EntityKey>::Key: Send,

§

impl<E> Sync for Response<E>
where E: Sync, <E as EntityKey>::Key: Sync,

§

impl<E> Unpin for Response<E>
where E: Unpin, <E as EntityKey>::Key: Unpin,

§

impl<E> UnsafeUnpin for Response<E>

§

impl<E> UnwindSafe for Response<E>
where E: UnwindSafe, <E as EntityKey>::Key: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V