Skip to main content

Filter

Struct Filter 

Source
pub struct Filter { /* private fields */ }
Expand description

A caller-side read input: the layer-interpreted param bag — and nothing else.

This is the input for the erased read path, ActionInput::read. Where a hand-built Query can carry a resource name the typed call site contradicts (silently overwritten) and load/aggregates/computed requests the erased path must reject, a Filter can carry neither: the resource is always named by the call site’s type parameter, and relationship loads / derived values are only expressible on the path that resolves them, Domain::read.

use ash_domain::{ActionInput, Filter};

let input = ActionInput::read(
    Filter::new().param("owner", "alice").param("limit", 50),
);

Implementations§

Source§

impl Filter

Source

pub fn new() -> Self

An empty filter: an unconstrained read of the resource.

Source

pub fn param(self, key: impl Into<String>, value: impl Into<Value>) -> Self

Set a param in the bag. What it means is the data layer’s convention, exactly as Query::param — the core attaches no semantics.

Source

pub fn params(self, params: impl IntoRecord) -> Result<Self>

Merge a whole typed param bag into the filter — the compile-checked sibling of param. params is anything IntoRecord (typically a #[derive(IntoRecord)] struct you define), so your layer’s param convention gets field names and types the compiler checks instead of strings. The core still attaches no semantics to any key — the struct is a contract between you and your data layer, exactly as with param. A key set both ways keeps the later value.

Fallible because IntoRecord is: an out-of-i64-range integer field has no lossless neutral form and fails loudly here.

use ash_domain::{ActionInput, Filter, IntoRecord};

#[derive(IntoRecord)]
struct OpenTodos {
    done: bool,
    limit: i64,
}

let input = ActionInput::read(
    Filter::new().params(OpenTodos { done: false, limit: 50 })?,
);

Trait Implementations§

Source§

impl Clone for Filter

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Filter

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Filter

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<Filter> for Query

A Filter is a Query with no resource name; the executor stamps the resource of the action it runs against (it does so for every read).

Source§

fn from(filter: Filter) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Forget for Filter

§

impl Freeze for Filter

§

impl Move for Filter

§

impl RefUnwindSafe for Filter

§

impl Send for Filter

§

impl Sync for Filter

§

impl Unpin for Filter

§

impl UnsafeUnpin for Filter

§

impl UnwindSafe for Filter

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<B> FromRef<B> for B
where B: Clone,

Source§

fn from_ref(backend: &B) -> B

Extract a Self from a reference to the composite backend B.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.