Skip to main content

TestApp

Struct TestApp 

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

Builder for constructing a fully-configured Autumn application in tests.

Analogous to Spring Boot’s @SpringBootTest – it wires up routes, middleware, config, and optionally a database pool, then produces a TestClient ready to fire requests.

§Examples

use autumn_web::prelude::*;
use autumn_web::test::TestApp;

#[get("/ping")]
async fn ping() -> &'static str { "pong" }

#[tokio::test]
async fn ping_works() {
    let client = TestApp::new()
        .routes(routes![ping])
        .build();

    client.get("/ping").send().await.assert_ok();
}

Implementations§

Source§

impl TestApp

Source

pub fn new() -> Self

Create a new test app builder with default configuration.

Source

pub fn policy<R, P>(self, policy: P) -> Self
where R: Send + Sync + 'static, P: Policy<R>,

Register a Policy for resource type R. Mirrors AppBuilder::policy.

Source

pub fn scope<R, S>(self, scope: S) -> Self
where R: Send + Sync + 'static, S: Scope<R>,

Register a Scope for resource type R. Mirrors AppBuilder::scope.

Source

pub const fn forbidden_response(self, value: ForbiddenResponse) -> Self

Override the deny-response shape used by #[authorize] and #[repository(policy = ...)] handlers. Useful for round-tripping the 403-vs-404 decision in tests.

Source

pub fn openapi(self, config: OpenApiConfig) -> Self

Enable OpenAPI spec generation for the test app.

Mirrors crate::app::AppBuilder::openapi so integration tests can exercise the /openapi.json and /swagger-ui endpoints.

Gated behind the openapi Cargo feature.

Source

pub fn mount_mcp(self, path: impl Into<String>) -> Self

Mount an MCP endpoint at path, mirroring AppBuilder::mount_mcp so integration tests can drive initialize/tools/list/tools/call through the in-process pipeline.

Gated behind the mcp Cargo feature.

Source

pub fn expose_all_as_mcp(self) -> Self

Enable the whole-API MCP hatch, mirroring AppBuilder::expose_all_as_mcp.

Gated behind the mcp Cargo feature.

Source

pub fn secure_mcp<L>(self, layer: L) -> Self
where L: Layer<Route> + Clone + Send + Sync + 'static, L::Service: Service<Request<Body>, Response = Response<Body>, Error = Infallible> + Clone + Send + Sync + 'static, <L::Service as Service<Request<Body>>>::Future: Send + 'static,

Gate the entire MCP endpoint behind a tower layer, mirroring AppBuilder::secure_mcp.

Gated behind the mcp Cargo feature.

Source

pub fn mcp_tasks(self, config: McpTaskConfig) -> Self

Set the limits for MCP task tools, mirroring AppBuilder::mcp_tasks.

Gated behind the mcp Cargo feature.

Source

pub fn mcp_instructions(self, text: impl Into<String>) -> Self

Set the MCP server instructions, mirroring AppBuilder::mcp_instructions.

Gated behind the mcp Cargo feature.

Source

pub fn mcp_catalog(self, catalog: McpCatalog) -> Self

Select the MCP tool catalog, mirroring AppBuilder::mcp_catalog.

Gated behind the mcp Cargo feature.

Source

pub fn merge(self, router: Router<AppState>) -> Self

Merge a router into the internal application state.

This is useful when testing modular route definitions without building the full application.

Source

pub fn scoped<L>(self, prefix: &str, layer: L, routes: Vec<Route>) -> Self
where L: Layer<Route> + Clone + Send + Sync + 'static, L::Service: Service<Request<Body>, Response = Response<Body>, Error = Infallible> + Clone + Send + Sync + 'static, <L::Service as Service<Request<Body>>>::Future: Send + 'static,

Mount routes under a scoped prefix with a route-local layer.

Source

pub fn nest(self, path: &str, router: Router<AppState>) -> Self

Nest a router under a specific path prefix for testing.

This is useful for testing sub-applications or API versions.

Source

pub fn layer<L: IntoAppLayer>(self, layer: L) -> Self

Apply a custom tower::Layer to the entire test application.

Mirrors crate::app::AppBuilder::layer so tests can exercise the exact middleware wiring that AppBuilder::run() produces.

Source

pub fn static_gate<L: IntoAppLayer>(self, layer: L) -> Self

Register a pre-static gate layer for this test application.

Mirrors crate::app::AppBuilder::static_gate: the layer runs outermost (outside session and before the static cache lookup) so tests can exercise auth-gating wiring that protects cached SSG/ISG pages.

Source

pub fn with_error_reporter<R: ErrorReporter>(self, reporter: R) -> Self

Register an ErrorReporter for this test app.

Mirrors crate::app::AppBuilder::with_error_reporter. Call multiple times to chain reporters; each receives every panic + 5xx event.

Source

pub const fn idempotent(self) -> Self

Enable HTTP idempotency-key middleware for this test app.

Mirrors crate::app::AppBuilder::idempotent: sets the config.idempotency.enabled flag so that the router wires up the layer with the same MemoryIdempotencyStore and MetricsCollector that production uses.

Source

pub fn from_router(router: Router, state: AppState) -> TestClient

Construct a TestClient directly from an axum::Router.

Useful for bypassing TestApp builder if you just want to write requests against a standard axum Router. The probe state returned by TestClient::probes will be in the default ready state; it is not connected to any handler in the supplied router.

Note: TestClient::sent_mail will always return an empty list for clients built this way. The built-in mail recorder is wired in during TestApp::build; because from_router receives an already-constructed AppState (with the mailer already installed), the recorder cannot be injected into its interceptor chain. Use TestApp::new().merge(router).build() to get recording support.

Source

pub fn routes(self, routes: Vec<Route>) -> Self

Register a collection of routes to be built into the TestApp.

Source

pub fn state_initializer<F>(self, f: F) -> Self
where F: FnOnce(&AppState) + Send + 'static,

Register a callback to configure/initialize the application state before building the router.

Source

pub fn with_live_state<T>(self, initial: T) -> Self
where T: LiveState,

Install a designated live-state block, so handlers that read it through AppState::live_state can be tested.

Mirrors crate::app::AppBuilder::with_live_state. A test app never adopts a snapshot from a predecessor — there is no upgrade in flight — so initial is always the value handlers see.

Source

pub fn with_flag_store<S>(self, store: S) -> Self
where S: FlagStore,

Register a FlagStore backend so the Flags extractor works in test handlers.

Mirrors crate::app::AppBuilder::with_flag_store.

Source

pub fn with_flag_service(self, service: FeatureFlagService) -> Self

Mirrors crate::app::AppBuilder::with_flag_service. The build preloads the store before the first request.

Source

pub fn with_notification_store<S>(self, store: S) -> Self

Source

pub fn with_push_subscription_store<S>(self, store: S) -> Self

Source

pub fn with_web_push(self, push: WebPush) -> Self

Register an explicit WebPush service, overriding key, store and transport at once.

The usual reason is a RecordingPushTransport, so a test can assert exactly what would have gone to the push service.

Source

pub fn plugin<P: Plugin>(self, plugin: P) -> Self

Apply a plugin directly to the test app.

Source

pub fn with_mail_interceptor(self, interceptor: impl MailInterceptor) -> Self

Source

pub fn with_suppression_store( self, store: impl SuppressionStore + 'static, ) -> Self

Register a SuppressionStore so List-Unsubscribe sends skip suppressed recipients and the unsubscribe endpoint records opt-outs. Mirrors AppBuilder::with_suppression_store.

Source

pub fn with_mail_suppression_store( self, store: impl SuppressionStore + 'static, ) -> Self

Register a bounce/complaint SuppressionStore so Mailer::send skips hard-bounced/complained addresses under TestApp exactly as it does under AppBuilder::run. Mirrors AppBuilder::with_mail_suppression_store.

Source

pub const fn mount_unsubscribe_endpoint(self) -> Self

Mount the framework’s default one-click unsubscribe endpoint (opt-in). Mirrors AppBuilder::mount_unsubscribe_endpoint.

Source

pub fn with_job_interceptor(self, interceptor: impl JobInterceptor) -> Self

Source

pub fn with_fault_plan(self, plan: FaultPlan) -> Self

Attach an authored, seed-deterministic fault schedule (FaultPlan, issue #1680).

The plan’s faults are injected through the existing interceptor seams, so no application code changes: the ordinal-th database checkout or job execution fails, exactly as a real transient failure would, and everything the run did is recorded into a serializable FaultOutcome reachable through TestClient::fault_outcome (or TestClient::fault_ledger).

It composes with, and never replaces, the interceptors already in play: the always-on enqueue recorder still records, a with_job_interceptor still runs (and observes the injected error like a real handler failure), transactional database isolation is preserved, and Sim::chaos keeps working alongside. The fault decision is innermost of each chain.

Attaching a plan registers an error reporter of its own, which — exactly like with_error_reporter — means the built-in LogReporter fallback is no longer installed for that app.

ⓘ
use autumn_web::sim::FaultPlan;

let client = TestApp::new()
    .plugin(ChargeCardJobs) // the plugin registering `charge_card`
    .with_fault_plan(FaultPlan::from_seed(0x5EED).fail_job("charge_card", 1))
    .build();
§Determinism

Attaching a plan also defaults the app’s entropy source to SeededEntropy::shared(plan.seed()) when the test supplied none, so request ids and job-retry jitter replay from the same seed. Run the scenario under #[sim_test] (a paused, single-threaded runtime with a virtual clock) for the ordinals to be reproducible; see the fault module docs.

§Panics

build panics if the config would make the fault schedule non-reproducible: more than one job worker (jobs.workers), error reporting disabled / sampled below 1.0 (the sampler draws OS randomness, so a sampled-out 5xx would be missing from the outcome at random), or failure capture enabled (reporting awaits the capsule’s blocking persistence before any reporter runs, so an observed 5xx could still be in flight when the outcome is read).

Source

pub fn jobs(self, jobs: Vec<JobInfo>) -> Self

Register background jobs with the test app.

Collect them with jobs![..], exactly as in AppBuilder::jobs. They run under the in-process test job runtime that build starts.

Source

pub fn tasks(self, tasks: Vec<TaskInfo>) -> Self

Register #[scheduled] tasks with the test app.

Collect them with tasks![..], exactly as in AppBuilder::tasks. build starts them on the in-process scheduler, and dropping the TestClient stops them. Their timers are tokio timers and they read the injected clock, so under a #[sim_test] a tick fires when crate::sim::Sim::advance crosses its deadline.

Source

pub fn listeners(self, listeners: Vec<ListenerInfo>) -> Self

Register event listeners with the test app.

Collect them with listeners![..], exactly as in AppBuilder::listeners. Durable listeners run under the in-process test job runtime; sync listeners run in-request. Published events are always recorded, so TestClient::assert_event_published works without standing up jobs.

Source

pub const fn with_outbox(self, config: OutboxConfig) -> Self

Enable the outbox relay with config (it sets enabled = true).

build cannot create the tables. Call crate::outbox::ensure_schema in the test first.

Source

pub fn outbox_handler<F, Fut>( self, topic: impl Into<String>, handler: F, ) -> Self
where F: Fn(AppState, OutboxMessage) -> Fut + Send + Sync + 'static, Fut: Future<Output = AutumnResult<()>> + Send + 'static,

Set the outbox handler of topic, as AppBuilder::outbox_handler.

The test app runs no relay worker. Drain the outbox with crate::outbox::drain or crate::sim::Sim::run_to_idle. Set outbox.enabled = true in the config, and create the tables with crate::outbox::ensure_schema.

§Panics

Panics when topic is empty or starts with autumn..

Source

pub fn with_db_interceptor( self, interceptor: impl DbConnectionInterceptor, ) -> Self

Source

pub fn with_channels_interceptor( self, interceptor: impl ChannelsInterceptor, ) -> Self

Source

pub fn record_broadcasts(self) -> Self

Opt in to recording every channel broadcast published while requests run, enabling TestClient::broadcasts, TestClient::broadcasts_on, and the assert_broadcast* helpers.

No interceptor is installed — and channel publishing is untouched — unless this is called. Composes with a user-supplied with_channels_interceptor: the recorder runs first, then the user’s interceptor.

Source

pub fn with_http_interceptor(self, interceptor: impl HttpInterceptor) -> Self

Source

pub fn config(self, config: AutumnConfig) -> Self

Override the default test configuration.

Source

pub fn profile(self, profile: &str) -> Self

Set the active profile (default is "test").

Source

pub fn with_clock<C>(self, clock: C) -> Self
where C: ClockSource + 'static,

Inject a custom clock into the test app.

All handlers that take a crate::time::Clock extractor will see time as reported by clock. Use crate::time::FixedClock to pin time to a known instant, or crate::time::TickingClock when you need to step the clock forward between requests via TestClient::advance_clock.

use autumn_web::test::TestApp;
use autumn_web::time::{FixedClock, TickingClock};
use chrono::{TimeZone, Utc};

// Pin to a fixed instant:
let _client = TestApp::new()
    .with_clock(FixedClock::at(Utc.with_ymd_and_hms(2025, 1, 1, 0, 0, 0).unwrap()))
    .build();

// Step forward in time:
let clock = TickingClock::starting_at(Utc.with_ymd_and_hms(2025, 1, 1, 0, 0, 0).unwrap());
let client = TestApp::new()
    .with_clock(clock.clone())
    .build();
client.advance_clock(std::time::Duration::from_secs(3600));
Source

pub fn with_entropy<E>(self, entropy: E) -> Self
where E: Entropy + 'static,

Inject a custom entropy source into the test app.

All handlers that take a crate::entropy::Rng extractor — and every framework-minted identifier (request ids, session ids, idempotency lock owners, job ids) — draw from entropy. Pass a crate::entropy::SeededEntropy to make the whole app’s identifier stream byte-for-byte reproducible under a fixed seed. Mirrors Self::with_clock.

use autumn_web::entropy::SeededEntropy;
use autumn_web::test::TestApp;

let _client = TestApp::new()
    .with_entropy(SeededEntropy::new(0x5eed))
    .build();
Source

pub fn api_version(self, version: ApiVersion) -> Self

Register a single API version for testing.

Source

pub fn agent_skill(self, skill: AgentSkill) -> Self

Publish an agent skill, as AppBuilder::agent_skill.

Source

pub fn ucp_profile(self, profile: UcpProfile) -> Self

Serve a UCP profile, as AppBuilder::ucp_profile.

Source

pub fn acp_discovery(self, document: AcpDiscovery) -> Self

Serve an ACP document, as AppBuilder::acp_discovery.

Source

pub fn api_versions( self, versions: impl IntoIterator<Item = ApiVersion>, ) -> Self

Register multiple API versions for testing.

Source

pub fn with_db(self, pool: Pool<RuntimeConnection>) -> Self

Attach a database connection pool to the test app.

Source

pub const fn transactional(self) -> Self

Enable transactional test isolation using the database URL configured in the application’s configuration.

Source

pub fn with_transactional_db(self, url: impl Into<String>) -> Self

Enable transactional test isolation with an explicit database URL.

Source

pub fn with_shards(self, shards: Vec<ShardConfig>) -> Self

Configure the application’s horizontal shards programmatically, as if they were declared via [[database.shards]] in autumn.toml.

This is the escape hatch for tests that spin up shard databases at runtime (e.g. one Postgres container per shard) and need to point the app at them without writing a config file. Combine with transactional to get rolled-back shard writes.

use autumn_web::test::TestApp;
use autumn_web::config::ShardConfig;

let client = TestApp::new()
    .with_transactional_db("postgres://localhost/control")
    .with_shards(vec![
        ShardConfig { name: "shard0".into(), primary_url: shard0, ..Default::default() },
        ShardConfig { name: "shard1".into(), primary_url: shard1, ..Default::default() },
    ])
    .build();
Source

pub fn http_mock(&mut self, alias: &str) -> MockSetupBuilder

Register a canned HTTP response for outbound requests made via the Client extractor during this test.

alias identifies the named service (must match the alias passed to Client::named in the handler, or the key used in [http.client.base_urls]).

Returns a MockSetupBuilder on which you chain the HTTP method and path before calling respond_with to register the entry and get a MockHandle for later assertions.

§Examples
use autumn_web::test::TestApp;
use serde_json::json;

let mut app = TestApp::new();
let mock = app
    .http_mock("stripe")
    .post("/v1/charges")
    .respond_with(200, json!({"id": "ch_123", "amount": 1000}));

let client = app.build();
// … fire requests …
mock.expect_called(1);
Source

pub fn build(self) -> TestClient

Build the application and return a TestClient ready for requests.

This constructs the full Axum router with all middleware applied, identical to what AppBuilder::run() produces – without binding a TCP listener.

The process-level global cache is cleared unconditionally so that #[cached] functions inside this test app always use their per-function Moka stores and do not accidentally inherit a Redis or other shared backend installed by a previous test.

Trait Implementations§

Source§

impl Default for TestApp

Source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AggregateExpressionMethods for T

Source§

fn aggregate_distinct(self) -> Self::Output
where Self: DistinctDsl,

DISTINCT modifier for aggregate functions Read more
Source§

fn aggregate_all(self) -> Self::Output
where Self: AllDsl,

ALL modifier for aggregate functions Read more
Source§

fn aggregate_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add an aggregate function filter Read more
Source§

fn aggregate_order<O>(self, o: O) -> Self::Output
where Self: OrderAggregateDsl<O>,

Add an aggregate function order Read more
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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> AutumnCounterCaches for T
where T: 'static,

Source§

const HAS_COUNTER_CACHES: bool = false

Whether this model has any counter cache at all. Read more
Source§

fn counter_caches() -> &'static [CounterCacheSpec<Self>]

The model’s counter-cache specs, in declaration order.
Source§

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

Source§

fn dependents() -> &'static [RuntimeDependentSpec]

The model’s dependent-cascade specs, in declaration order. Defaults to none; #[model] overrides via an inherent shadow when dependents exist.
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoSql for T

Source§

fn into_sql<T>(self) -> Self::Expression

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> RepositoryHooksDefault for T
where T: Default,

Source§

fn autumn_default() -> T

Construct a hook instance for generated repository state.
Source§

impl<T, Conn> RunQueryDsl<Conn> for T

Source§

fn execute<'conn, 'query>( self, conn: &'conn mut Conn, ) -> <Conn as AsyncConnectionCore>::ExecuteFuture<'conn, 'query>
where Conn: AsyncConnectionCore + Send, Self: ExecuteDsl<Conn> + 'query,

Executes the given command, returning the number of rows affected. Read more
Source§

fn load<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>>
where U: Send, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Executes the given query, returning a Vec with the returned rows. Read more
Source§

fn load_stream<'conn, 'query, U>( self, conn: &'conn mut Conn, ) -> Self::LoadFuture<'conn>
where Conn: AsyncConnectionCore, U: 'conn, Self: LoadQuery<'query, Conn, U> + 'query,

Executes the given query, returning a [Stream] with the returned rows. Read more
Source§

fn get_result<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, LoadNext<Pin<Box<Self::Stream<'conn>>>>>
where U: Send + 'conn, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Runs the command, and returns the affected row. Read more
Source§

fn get_results<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>>
where U: Send, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Runs the command, returning an Vec with the affected rows. Read more
Source§

fn first<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<<Self::Output as LoadQuery<'query, Conn, U>>::LoadFuture<'conn>, LoadNext<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>>
where U: Send + 'conn, Conn: AsyncConnectionCore, Self: LimitDsl, Self::Output: LoadQuery<'query, Conn, U> + Send + 'query,

Attempts to load a single record. Read more
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 = !

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WindowExpressionMethods for T

Source§

fn over(self) -> Self::Output
where Self: OverDsl,

Turn a function call into a window function call Read more
Source§

fn window_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add a filter to the current window function Read more
Source§

fn partition_by<E>(self, expr: E) -> Self::Output
where Self: PartitionByDsl<E>,

Add a partition clause to the current window function Read more
Source§

fn window_order<E>(self, expr: E) -> Self::Output
where Self: OrderWindowDsl<E>,

Add a order clause to the current window function Read more
Source§

fn frame_by<E>(self, expr: E) -> Self::Output
where Self: FrameDsl<E>,

Add a frame clause to the current window function Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more