Skip to main content

Verifier

Struct Verifier 

Source
pub struct Verifier<ZS, Mempool> {
    network: Network,
    state: Timeout<ZS>,
    mempool: Option<Timeout<Mempool>>,
    script_verifier: Verifier,
    mempool_setup_rx: Receiver<Mempool>,
}
Expand description

Asynchronous transaction verification.

§Correctness

Transaction verification requests should be wrapped in a timeout, so that out-of-order and invalid requests do not hang indefinitely. See the router module documentation for details.

Fields§

§network: Network§state: Timeout<ZS>§mempool: Option<Timeout<Mempool>>§script_verifier: Verifier§mempool_setup_rx: Receiver<Mempool>

Implementations§

Source§

impl<ZS, Mempool> Verifier<ZS, Mempool>
where ZS: Service<Request, Response = Response, Error = BoxError> + Send + Clone + 'static, ZS::Future: Send + 'static, Mempool: Service<Request, Response = Response, Error = BoxError> + Send + Clone + 'static, Mempool::Future: Send + 'static,

Source

pub fn new( network: &Network, state: ZS, mempool_setup_rx: Receiver<Mempool>, ) -> Self

Create a new transaction verifier.

Source§

impl<ZS, Mempool> Verifier<ZS, Mempool>
where ZS: Service<Request, Response = Response, Error = BoxError> + Send + Clone + 'static, ZS::Future: Send + 'static, Mempool: Service<Request, Response = Response, Error = BoxError> + Send + Clone + 'static, Mempool::Future: Send + 'static,

Source

fn verify_block( &self, req: Request, ) -> Pin<Box<dyn Future<Output = Result<Response, TransactionError>> + Send + 'static>>

Verifies a transaction in block context.

Source

fn verify_mempool( &self, req: Request, ) -> Pin<Box<dyn Future<Output = Result<Response, TransactionError>> + Send + 'static>>

Verifies a transaction in mempool context.

Source

fn check_structure_and_network_rules( tx: &Transaction, height: Height, network: &Network, ) -> Result<(), TransactionError>

Performs basic structural validation and Orchard-related network upgrade rules.

Source

fn check_transaction_invariants( tx: &Transaction, height: Height, network: &Network, ) -> Result<(), TransactionError>

Validates transaction invariants.

Source

async fn verify_mempool_lock_time( tx: &Transaction, height: Height, state: Timeout<ZS>, ) -> Result<(), TransactionError>

Validates mempool lock-time consensus rules.

Queries state only for time-based lock times.

Source

async fn mempool_best_chain_next_median_time_past( state: Timeout<ZS>, ) -> Result<DateTime32, TransactionError>

Fetches the median-time-past of the next block after the best state tip.

This is used to verify that the lock times of mempool transactions can be included in any valid next block.

Source

async fn block_spent_utxos( tx: Arc<Transaction>, known_utxos: Arc<HashMap<OutPoint, OrderedUtxo>>, state: Timeout<ZS>, ) -> Result<(HashMap<OutPoint, Utxo>, Vec<Output>), TransactionError>

Looks up UTXOs spent by tx from the best chain state, also checking known_utxos for UTXOs from earlier transactions in the same block.

Returns an OutPoint -> Utxo map and a vec of Outputs in the same order as the matching inputs in tx.

Source

async fn mempool_spent_utxos( tx: Arc<Transaction>, height: Height, state: Timeout<ZS>, mempool: Option<Timeout<Mempool>>, ) -> Result<(HashMap<OutPoint, Utxo>, Vec<Output>, Vec<OutPoint>), TransactionError>

Looks up UTXOs spent by a mempool tx, first querying the best chain state and then the mempool for inputs whose outputs are not present in the best chain.

height is the next block height, used to construct Utxo values for outputs sourced from the mempool.

Returns an OutPoint -> Utxo map, a vec of Outputs in the same order as the matching inputs in tx, and a vec of OutPoints that were sourced from the mempool rather than the best chain.

Source

fn check_maturity_height( tx: Arc<Transaction>, height: Height, network: &Network, spent_utxos: &HashMap<OutPoint, Utxo>, ) -> Result<(), TransactionError>

Checks that every transparent coinbase output spent by tx has matured by height.

This check applies only to mempool transactions. Block transactions are checked during contextual validation in the state (see #2336).

Calls check::tx_transparent_coinbase_spends_maturity with an empty block_new_outputs map, since mempool transactions have no block context.

Returns Ok(()) if every transparent coinbase output spent by the transaction is mature and valid for the given height, or a TransactionError if the transaction spends transparent coinbase outputs that are immature and invalid for the given height.

Source

fn dispatch_version_verification( tx: &Transaction, nu: NetworkUpgrade, script_verifier: Verifier, cached_ffi_transaction: Arc<CachedFfiTransaction>, ) -> Result<AsyncChecks, TransactionError>

Dispatches version-specific async verification checks for tx.

nu is the network upgrade active at the transaction’s block height, pre-computed by the caller from req.upgrade(&network).

Returns TransactionError::WrongVersion for V1-V3 transactions, which are not supported by any network upgrade Zebra verifies.

Source

fn verify_v4_transaction( tx: &Transaction, nu: NetworkUpgrade, script_verifier: Verifier, cached_ffi_transaction: Arc<CachedFfiTransaction>, joinsplit_data: &Option<JoinSplitData<Groth16Proof>>, ) -> Result<AsyncChecks, TransactionError>

Verify a V4 transaction.

Returns a set of asynchronous checks that must all succeed for the transaction to be considered valid. These checks include:

  • transparent transfers
  • sprout shielded data
  • sapling shielded data

The parameters of this method are:

  • the tx transaction to verify
  • the nu network upgrade active at the transaction’s block height
  • the script_verifier to use for verifying the transparent transfers
  • the prepared cached_ffi_transaction used by the script verifier
  • the Sprout joinsplit_data shielded data in the transaction
Source

fn verify_v4_transaction_network_upgrade( transaction: &Transaction, network_upgrade: NetworkUpgrade, ) -> Result<(), TransactionError>

Verifies if a V4 transaction is supported by network_upgrade.

Source

fn verify_v5_transaction( tx: &Transaction, nu: NetworkUpgrade, script_verifier: Verifier, cached_ffi_transaction: Arc<CachedFfiTransaction>, ) -> Result<AsyncChecks, TransactionError>

Verify a V5 transaction.

Returns a set of asynchronous checks that must all succeed for the transaction to be considered valid. These checks include:

  • transaction support by the considered network upgrade (see Request::upgrade)
  • transparent transfers
  • sapling shielded data (TODO)
  • orchard shielded data (TODO)

The parameters of this method are:

  • the tx transaction to verify
  • the nu network upgrade active at the transaction’s block height
  • the script_verifier to use for verifying the transparent transfers
  • the prepared cached_ffi_transaction used by the script verifier
Source

fn verify_v5_transaction_network_upgrade( transaction: &Transaction, network_upgrade: NetworkUpgrade, ) -> Result<(), TransactionError>

Verifies if a V5 transaction is supported by network_upgrade.

Source

fn verify_v6_transaction( tx: &Transaction, nu: NetworkUpgrade, script_verifier: Verifier, cached_ffi_transaction: Arc<CachedFfiTransaction>, ) -> Result<AsyncChecks, TransactionError>

Verifies a V6 (NU6.3 / Ironwood) transaction’s shielded data.

Differs from Self::verify_v5_transaction in the Orchard verifier: a v6 Orchard bundle commits to the NU6.3 cross-address circuit, so it (and the Ironwood bundle) verify under the NU6.3 key, not the v5 fixed key.

Source

fn verify_v6_transaction_network_upgrade( transaction: &Transaction, network_upgrade: NetworkUpgrade, ) -> Result<(), TransactionError>

Verifies that a V6 transaction is supported by network_upgrade.

V6 transactions are only valid from NU6.3 onward.

Source

fn verify_transparent_inputs_and_outputs( tx: &Transaction, script_verifier: Verifier, cached_ffi_transaction: Arc<CachedFfiTransaction>, ) -> Result<AsyncChecks, TransactionError>

Verifies if a transaction’s transparent inputs are valid using the provided script_verifier and cached_ffi_transaction.

Returns script verification responses via the utxo_sender.

Source

fn verify_sprout_shielded_data( joinsplit_data: &Option<JoinSplitData<Groth16Proof>>, shielded_sighash: &SigHash, ) -> Result<AsyncChecks, TransactionError>

Verifies a transaction’s Sprout shielded join split data.

Source

fn verify_sapling_bundle( bundle: Option<Bundle<Authorized, ZatBalance>>, sighash: &SigHash, ) -> AsyncChecks

Verifies a transaction’s Sapling shielded data.

Source

fn verify_orchard_bundle( bundle: Option<Bundle<Authorized, ZatBalance>>, sighash: &SigHash, network_upgrade: NetworkUpgrade, ) -> AsyncChecks

Verifies a v5 transaction’s Orchard bundle.

A v5 Orchard bundle commits to the Orchard Action circuit of the block’s era, so the verifying key is selected by network_upgrade via primitives::halo2::orchard_v5_verifier_for: the historical insecure key before NU6.2, the fixed key from NU6.2 until NU6.3, and the NU6.3 key from NU6.3 onward. The Orchard-pool cross-address restriction applies to every Orchard Action from NU6.3 onward regardless of transaction version (ZIP 229), so a v5 bundle at NU6.3 uses the NU6.3 circuit — the same key as v6 Orchard and Ironwood bundles — not the fixed one.

Source

fn verify_orchard_v6_bundle( bundle: Option<Bundle<Authorized, ZatBalance>>, sighash: &SigHash, ) -> AsyncChecks

Verifies a v6 transaction’s Orchard bundle.

A v6 Orchard bundle commits to the NU6.3 cross-address circuit, so it always verifies under the NU6.3 key (primitives::halo2::orchard_v6_verifier), independent of the block’s network upgrade (v6 transactions only exist from NU6.3 onward). The Ironwood bundle reuses the same verifier.

Source

fn queue_orchard_bundle( select_verifier: impl FnOnce() -> &'static VerifierService, bundle: Option<Bundle<Authorized, ZatBalance>>, sighash: &SigHash, ) -> AsyncChecks

Queues an Orchard-shaped bundle’s single aggregated Halo2 proof against a verifier.

§Consensus

The proof 𝜋 MUST be valid given a primary input (cv, rt^{Orchard}, nf, rk, cm_x, enableSpends, enableOutputs)

https://zips.z.cash/protocol/protocol.pdf#actiondesc

Unlike Sapling, Orchard shielded transactions have a single aggregated Halo2 proof per transaction, even with multiple Actions, so it is queued for verification only once instead of once per Action description. The choice of verifying key is the caller’s; see Self::verify_orchard_bundle and Self::verify_orchard_v6_bundle.

select_verifier is only invoked when a bundle is present, so a bundle-less transaction never forces the (lazily initialized) verifier services.

Source

fn miner_fee( tx: &Transaction, spent_utxos: &HashMap<OutPoint, Utxo>, ) -> Result<Amount<NonNegative>, TransactionError>

Calculate the miner fee from the transaction’s value balance.

Trait Implementations§

Source§

impl<ZS, Mempool> Service<Request> for Verifier<ZS, Mempool>
where ZS: Service<Request, Response = Response, Error = BoxError> + Send + Clone + 'static, ZS::Future: Send + 'static, Mempool: Service<Request, Response = Response, Error = BoxError> + Send + Clone + 'static, Mempool::Future: Send + 'static,

Source§

type Response = Response

Responses given by the service.
Source§

type Error = TransactionError

Errors produced by the service.
Source§

type Future = Pin<Box<dyn Future<Output = Result<<Verifier<ZS, Mempool> as Service<Request>>::Response, <Verifier<ZS, Mempool> as Service<Request>>::Error>> + Send>>

The future response value.
Source§

fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>

Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more
Source§

fn call(&mut self, req: Request) -> Self::Future

Process the request and return the response asynchronously. Read more

Auto Trait Implementations§

§

impl<ZS, Mempool> !RefUnwindSafe for Verifier<ZS, Mempool>

§

impl<ZS, Mempool> !UnwindSafe for Verifier<ZS, Mempool>

§

impl<ZS, Mempool> Freeze for Verifier<ZS, Mempool>
where ZS: Freeze, Mempool: Freeze,

§

impl<ZS, Mempool> Send for Verifier<ZS, Mempool>
where ZS: Send, Mempool: Send,

§

impl<ZS, Mempool> Sync for Verifier<ZS, Mempool>
where ZS: Sync, Mempool: Sync + Send,

§

impl<ZS, Mempool> Unpin for Verifier<ZS, Mempool>
where ZS: Unpin, Mempool: Unpin,

§

impl<ZS, Mempool> UnsafeUnpin for Verifier<ZS, Mempool>
where ZS: UnsafeUnpin, Mempool: UnsafeUnpin,

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
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

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

§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

fn in_current_span(self) -> Instrumented<Self>

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<S, Request> IsReady<Request> for S
where S: Service<Request> + Send, Request: 'static,

Source§

fn is_ready(&mut self) -> Pin<Box<dyn Future<Output = bool> + Send + '_>>

Poll the [Service] once, and return true if it is immediately ready to be called.
Source§

fn is_pending(&mut self) -> Pin<Box<dyn Future<Output = bool> + Send + '_>>

Poll the [Service] once, and return true if it is pending.
Source§

fn is_failed(&mut self) -> Pin<Box<dyn Future<Output = bool> + Send + '_>>

Poll the [Service] once, and return true if it has failed.
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> MaybeSendSync for T

§

impl<D> OwoColorize for D

§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either [OwoColorize::fg] or a color-specific method, such as [OwoColorize::green], Read more
§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either [OwoColorize::bg] or a color-specific method, such as [OwoColorize::on_yellow], Read more
§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
§

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

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

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

§

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
§

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<Response, Error> ResponseResult<Response, Error> for Response

Source§

fn into_result(self) -> Result<Response, Error>

Converts the type into a Result that can be sent as a response.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<S, R> ServiceExt<R> for S
where S: Service<R>,

§

fn into_make_service(self) -> IntoMakeService<S>

Convert this service into a MakeService, that is a [Service] whose response is another service. Read more
§

fn handle_error<F, T>(self, f: F) -> HandleError<Self, F, T>

Convert this service into a HandleError, that will handle errors by converting them into responses. Read more
§

impl<T, Request> ServiceExt<Request> for T
where T: Service<Request> + ?Sized,

§

fn ready(&mut self) -> Ready<'_, Self, Request>
where Self: Sized,

Yields a mutable reference to the service when it is ready to accept a request.
§

fn ready_and(&mut self) -> Ready<'_, Self, Request>
where Self: Sized,

👎Deprecated since 0.4.6:

please use the ServiceExt::ready method instead

Yields a mutable reference to the service when it is ready to accept a request.
§

fn ready_oneshot(self) -> ReadyOneshot<Self, Request>
where Self: Sized,

Yields the service when it is ready to accept a request.
§

fn oneshot(self, req: Request) -> Oneshot<Self, Request>
where Self: Sized,

Consume this Service, calling with the providing request once it is ready.
§

fn call_all<S>(self, reqs: S) -> CallAll<Self, S>
where Self: Sized, Self::Error: Into<Box<dyn Error + Send + Sync>>, S: Stream<Item = Request>,

Process all requests from the given Stream, and produce a Stream of their responses. Read more
§

fn and_then<F>(self, f: F) -> AndThen<Self, F>
where Self: Sized, F: Clone,

Executes a new future after this service’s future resolves. This does not alter the behaviour of the poll_ready method. Read more
§

fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
where Self: Sized, F: FnOnce(Self::Response) -> Response + Clone,

Maps this service’s response value to a different value. This does not alter the behaviour of the poll_ready method. Read more
§

fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
where Self: Sized, F: FnOnce(Self::Error) -> Error + Clone,

Maps this service’s error value to a different value. This does not alter the behaviour of the poll_ready method. Read more
§

fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
where Self: Sized, Error: From<Self::Error>, F: FnOnce(Result<Self::Response, Self::Error>) -> Result<Response, Error> + Clone,

Maps this service’s result type (Result<Self::Response, Self::Error>) to a different value, regardless of whether the future succeeds or fails. Read more
§

fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
where Self: Sized, F: FnMut(NewRequest) -> Request,

Composes a function in front of the service. Read more
§

fn filter<F, NewRequest>(self, filter: F) -> Filter<Self, F>
where Self: Sized, F: Predicate<NewRequest>,

Composes this service with a Filter that conditionally accepts or rejects requests based on a predicate. Read more
§

fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>
where Self: Sized, F: AsyncPredicate<NewRequest>,

Composes this service with an AsyncFilter that conditionally accepts or rejects requests based on an [async predicate]. Read more
§

fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
where Self: Sized, Error: From<Self::Error>, F: FnOnce(Result<Self::Response, Self::Error>) -> Fut + Clone, Fut: Future<Output = Result<Response, Error>>,

Composes an asynchronous function after this service. Read more
§

fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
where Self: Sized, F: FnMut(Self::Future) -> Fut, Error: From<Self::Error>, Fut: Future<Output = Result<Response, Error>>,

Composes a function that transforms futures produced by the service. Read more
§

fn boxed(self) -> BoxService<Request, Self::Response, Self::Error>
where Self: Sized + Send + 'static, Self::Future: Send + 'static,

Convert the service into a Service + Send trait object. Read more
§

fn boxed_clone(self) -> BoxCloneService<Request, Self::Response, Self::Error>
where Self: Sized + Clone + Send + 'static, Self::Future: Send + 'static,

Convert the service into a Service + Clone + Send trait object. Read more
§

impl<T, Request> ServiceExt<Request> for T
where T: Service<Request> + ?Sized,

§

fn ready(&mut self) -> Ready<'_, Self, Request>
where Self: Sized,

Yields a mutable reference to the service when it is ready to accept a request.
§

fn ready_oneshot(self) -> ReadyOneshot<Self, Request>
where Self: Sized,

Yields the service when it is ready to accept a request.
§

fn oneshot(self, req: Request) -> Oneshot<Self, Request>
where Self: Sized,

Consume this Service, calling it with the provided request once it is ready.
§

fn call_all<S>(self, reqs: S) -> CallAll<Self, S>
where Self: Sized, S: Stream<Item = Request>,

Process all requests from the given Stream, and produce a Stream of their responses. Read more
§

fn and_then<F>(self, f: F) -> AndThen<Self, F>
where Self: Sized, F: Clone,

Executes a new future after this service’s future resolves. This does not alter the behaviour of the poll_ready method. Read more
§

fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
where Self: Sized, F: FnOnce(Self::Response) -> Response + Clone,

Maps this service’s response value to a different value. This does not alter the behaviour of the poll_ready method. Read more
§

fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
where Self: Sized, F: FnOnce(Self::Error) -> Error + Clone,

Maps this service’s error value to a different value. This does not alter the behaviour of the poll_ready method. Read more
§

fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
where Self: Sized, Error: From<Self::Error>, F: FnOnce(Result<Self::Response, Self::Error>) -> Result<Response, Error> + Clone,

Maps this service’s result type (Result<Self::Response, Self::Error>) to a different value, regardless of whether the future succeeds or fails. Read more
§

fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
where Self: Sized, F: FnMut(NewRequest) -> Request,

Composes a function in front of the service. Read more
§

fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
where Self: Sized, Error: From<Self::Error>, F: FnOnce(Result<Self::Response, Self::Error>) -> Fut + Clone, Fut: Future<Output = Result<Response, Error>>,

Composes an asynchronous function after this service. Read more
§

fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
where Self: Sized, F: FnMut(Self::Future) -> Fut, Error: From<Self::Error>, Fut: Future<Output = Result<Response, Error>>,

Composes a function that transforms futures produced by the service. Read more
§

fn boxed(self) -> BoxService<Request, Self::Response, Self::Error>
where Self: Sized + Send + 'static, Self::Future: Send + 'static,

Convert the service into a Service + Send trait object. Read more
§

fn boxed_clone(self) -> BoxCloneService<Request, Self::Response, Self::Error>
where Self: Sized + Clone + Send + 'static, Self::Future: Send + 'static,

Convert the service into a Service + Clone + Send trait object. Read more
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. 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

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.