Skip to main content

ValidatorConfigV2

Struct ValidatorConfigV2 

Source
pub struct ValidatorConfigV2 {
    pub config: <Config as StorableType>::Handler,
    pub validators: <Vec<ValidatorRecord> as StorableType>::Handler,
    pub address_to_index: <Mapping<Address, u64> as StorableType>::Handler,
    pub pubkey_to_index: <Mapping<B256, u64> as StorableType>::Handler,
    pub next_network_identity_rotation_epoch: <u64 as StorableType>::Handler,
    pub active_ingress_ips: <Mapping<B256, bool> as StorableType>::Handler,
    pub active_indices: <Vec<u64> as StorableType>::Handler,
    address: Address,
    storage: StorageCtx,
}

Fields§

§config: <Config as StorableType>::Handler§validators: <Vec<ValidatorRecord> as StorableType>::Handler§address_to_index: <Mapping<Address, u64> as StorableType>::Handler§pubkey_to_index: <Mapping<B256, u64> as StorableType>::Handler§next_network_identity_rotation_epoch: <u64 as StorableType>::Handler§active_ingress_ips: <Mapping<B256, bool> as StorableType>::Handler§active_indices: <Vec<u64> as StorableType>::Handler§address: Address§storage: StorageCtx

Implementations§

Source§

impl ValidatorConfigV2

Source

pub fn new() -> Self

Creates an instance of the precompile.

Caution: This does not initialize the account, see Self::initialize.

Source

fn __new(address: Address) -> Self

Source

fn __initialize(&mut self) -> Result<()>

Source

fn emit_event(&mut self, event: impl IntoLogData) -> Result<()>

Source

pub fn emitted_events(&self) -> &Vec<LogData>

Available on crate features test-utils only.
Source

pub fn clear_emitted_events(&mut self)

Available on crate features test-utils only.
Source

pub fn assert_emitted_events(&self, expected: Vec<impl IntoLogData>)

Available on crate features test-utils only.
Source§

impl ValidatorConfigV2

Source

pub fn initialize(&mut self, owner: Address) -> Result<()>

Initializes the validator config V2 precompile.

The contract is fully operational immediately: is_init is set to true and all mutating functions (add_validator, rotate_validator, etc.) are unlocked.

For V1 migration, the contract is NOT initialized — instead migrate_validator manually copies validators and initialize_if_migrated flips is_init once all have been migrated.

Source

pub fn owner(&self) -> Result<Address>

Returns the current owner of the contract.

Source

pub fn get_initialized_at_height(&self) -> Result<u64>

Returns the block height at which the contract was initialized.

Only meaningful when is_initialized returns true.

Source

pub fn is_initialized(&self) -> Result<bool>

Returns whether V2 has been initialized (either directly or via migration).

When false, the CL reads from V1 and mutating operations (except deactivate_validator and migration functions) are blocked.

Source

pub fn validator_count(&self) -> Result<u64>

Returns the total number of validators ever added, including deactivated entries and rotation snapshots.

Source

fn get_active_validator(&self, idx: u64) -> Result<ValidatorRecord>

Returns the validator at the given global index, or errors if the index is out of bounds or the validator has been deactivated.

Source

fn read_validator_at(&self, index: u64) -> Result<Validator>

Source

pub fn validator_by_index(&self, index: u64) -> Result<Validator>

Returns the validator registry at the given global index in the validators array.

§Errors
  • ValidatorNotFoundindex is out of bounds
Source

pub fn validator_by_address(&self, addr: Address) -> Result<Validator>

Looks up a validator registry by its address.

Returns the current entry for the address (after any rotations or transfers).

§Errors
  • ValidatorNotFound — the address has never been registered
Source

pub fn validator_by_public_key(&self, pubkey: B256) -> Result<Validator>

Looks up a validator by its Ed25519 public key.

For rotated validators, the old public key resolves to the deactivated snapshot, while the new key resolves to the in-place active entry.

§Errors
  • ValidatorNotFound — the public key has never been registered
Source

pub fn get_active_validators(&self) -> Result<Vec<Validator>>

Returns only active validators (where deactivatedAtHeight == 0).

NOTE: the order of returned validator records is NOT stable and should NOT be relied upon.

Source

pub fn get_next_network_identity_rotation_epoch(&self) -> Result<u64>

Returns the epoch at which a network identity rotation will be triggered.

See set_network_identity_rotation_epoch.

Source

fn validate_endpoints(ingress: &str, egress: &str) -> Result<()>

Source

fn ingress_key(ingress: &str) -> Result<B256>

Parses ingress as an <ip>:<port> pair and returns the hash of the ingress’ binary representation.

For V4 addresses, that’s keccak256(octets(ip) || big_endian(port)).

For V6 addresses, that’s keccak256(octets(ip) || big_endian(scope_id) || big_endian(port)).

Source

fn require_unique_ingress(&self, ingress: &str) -> Result<B256>

Source

fn update_ingress_ip_tracking( &mut self, old_ingress: &str, new_ingress: &str, ) -> Result<()>

Source

fn append_validator( &mut self, addr: Address, pubkey: B256, ingress: String, egress: String, fee_recipient: Address, added_at_height: u64, deactivated_at_height: u64, ) -> Result<u64>

Source

fn require_new_address(&self, addr: Address) -> Result<()>

Allows reusing addresses of deactivated validators.

Source

fn require_new_pubkey(&self, pubkey: B256) -> Result<()>

Source

fn verify_validator_signature( &self, kind: SignatureKind, pubkey: &B256, signature: &[u8], validator_address: Address, ingress: &str, egress: &str, ) -> Result<()>

Verifies a validator signature for add or rotate operations.

Constructs the message according to the validator config v2 specification and verifies the Ed25519 signature using the appropriate namespace.

Source

pub fn add_validator( &mut self, sender: Address, call: addValidatorCall, ) -> Result<u64>

Adds a new validator to the set (owner only).

Requires a valid Ed25519 signature, using the VALIDATOR_NS_ADD namespace, over keccak256(chainId || contractAddr || validatorAddr || len(ingress) || ingress || len(egress) || egress || feeRecipient) which proves that the caller controls the private key corresponding to publicKey.

§Errors
  • NotInitialized — the contract has not been initialized
  • Unauthorizedsender is not the owner
  • InvalidPublicKeypublicKey is zero or not a valid Ed25519 key
  • PublicKeyAlreadyExists — the public key is already registered
  • InvalidValidatorAddressvalidatorAddress is zero
  • AddressAlreadyHasValidator — the address belongs to an active validator
  • NotIpPort / NotIp — endpoints fail validation
  • IngressAlreadyExists — the new ingress is already in use
  • InvalidSignature — signature verification fails
Source

pub fn deactivate_validator( &mut self, sender: Address, call: deactivateValidatorCall, ) -> Result<()>

Deactivates a validator by setting its deactivatedAtHeight to the current block height (owner or the validator itself).

The validator’s entry remains in storage for historical queries and its public key stays reserved forever. The ingress IP is freed for reuse.

Does NOT require initialization — can be called during the migration window.

Uses swap-and-pop on active_indices for O(1) removal.

§Errors
  • ValidatorNotFoundidx is out of bounds
  • ValidatorAlreadyDeleted — the validator is already deactivated
  • Unauthorizedsender is neither the owner nor the validator
Source

pub fn transfer_ownership( &mut self, sender: Address, call: transferOwnershipCall, ) -> Result<()>

Transfers ownership of the contract to a new address (owner only).

§Errors
  • InvalidOwnernewOwner is address(0)
  • Unauthorizedsender is not the owner
  • NotInitialized — the contract has not been initialized
Source

pub fn set_network_identity_rotation_epoch( &mut self, sender: Address, call: setNetworkIdentityRotationEpochCall, ) -> Result<()>

Sets the epoch at which a rotation of the network identity will be triggered.

If E is ahead of the network’s current epoch, the network will perform a Distribute-Key-Generation (DKG) ceremony to rotate its identity at the new epoch E.

  • If the DKG ceremony is successful, then epoch E+1 will run with a new network identity.
  • If E is not ahead of the network epoch this value is ignored.
Source

pub fn rotate_validator( &mut self, sender: Address, call: rotateValidatorCall, ) -> Result<()>

Rotates a validator to a new identity (owner or the validator itself).

Atomically:

  1. Appends a deactivated snapshot of the old identity to the tail of validators
  2. Overwrites the slot in-place with new pubkey, endpoints, and addedAtHeight = now

The validator’s global index, active_idx, address_to_index pointer, and position in active_indices are all preserved — only pubkey_to_index is updated (old key -> snapshot, new key -> original slot).

Requires a valid Ed25519 signature, using the VALIDATOR_NS_ROTATE namespace, over keccak256(chainId || contractAddr || validatorAddr || len(ingress) || ingress || len(egress) || egress) which proves that the caller controls the private key corresponding to publicKey.

§Errors
  • ValidatorNotFound / ValidatorAlreadyDeletedidx is invalid
  • NotInitialized / Unauthorized — auth failure
  • InvalidPublicKey / PublicKeyAlreadyExists — the new key is invalid
  • NotIpPort / NotIp / IngressAlreadyExists — endpoint validation failure
  • InvalidSignature — signature verification fails
Source

pub fn set_fee_recipient( &mut self, sender: Address, call: setFeeRecipientCall, ) -> Result<()>

Updates the fee recipient address for a validator (owner or the validator itself).

§Errors
  • NotInitialized — the contract has not been initialized
  • ValidatorNotFound / ValidatorAlreadyDeletedidx is invalid
  • Unauthorizedsender is neither the owner nor the validator
Source

pub fn set_ip_addresses( &mut self, sender: Address, call: setIpAddressesCall, ) -> Result<()>

Updates a validator’s ingress and egress addresses (owner or the validator itself).

§Errors
  • NotInitialized — the contract has not been initialized
  • ValidatorNotFound / ValidatorAlreadyDeletedidx is invalid
  • Unauthorizedsender is neither the owner nor the validator
  • NotIpPort / NotIp — the new endpoints fail validation
  • IngressAlreadyExists — the new ingress is already in use.
Source

pub fn transfer_validator_ownership( &mut self, sender: Address, call: transferValidatorOwnershipCall, ) -> Result<()>

Transfers a validator entry to a new address (owner or the validator itself).

Updates the validator’s address in the lookup maps: deletes the old address_to_index entry and creates a new one pointing to the same slot.

§Errors
  • ValidatorNotFound / ValidatorAlreadyDeletedidx is invalid
  • NotInitialized / Unauthorized — auth failure
  • InvalidValidatorAddressnewAddress is zero
  • AddressAlreadyHasValidatornewAddress belongs to an active validator
Source

fn require_migration_owner(&mut self, caller: Address) -> Result<Config>

On the very first migration call the V2 owner is still zero, so we copy it from V1 before checking authorization. Returns the (potentially updated) config for reuse.

§Errors
  • AlreadyInitialized — V2 is already initialized
  • Unauthorizedcaller is not the owner (after copying from V1 if needed)
Source

pub fn migrate_validator( &mut self, sender: Address, call: migrateValidatorCall, ) -> Result<()>

Migrates a single validator from V1 to V2 (owner only).

Must be called once per V1 validator, in reverse index order. On the first call, copies the owner from V1 if V2’s owner is address(0).

Validators are skipped (not reverted) when:

  • The public key is not a valid Ed25519 key
  • The egress address cannot be parsed as a SocketAddr
  • The public key or ingress IP is a duplicate of an already-migrated entry

Active V1 validators get deactivatedAtHeight = 0; inactive ones get deactivatedAtHeight = block.number.

§Errors
  • Unauthorizedsender is not the owner
  • AlreadyInitialized — V2 is already initialized
  • InvalidMigrationIndexidx is out of order
Source

pub fn initialize_if_migrated(&mut self, sender: Address) -> Result<()>

Finalizes V1 -> V2 migration by setting is_init = true.

Should only be called after all V1 validators have been migrated via migrate_validator. Copies nextDkgCeremony from V1. After this call, the CL reads from V2 instead of V1 and all mutating functions are unlocked.

§Errors
  • Unauthorizedsender is not the owner
  • AlreadyInitialized — V2 is already initialized
  • MigrationNotCompletevalidator_count + skipped < v1.validator_count
Source§

impl ValidatorConfigV2

Source

pub fn create_precompile(cfg: &CfgEnv<TempoHardfork>) -> DynPrecompile

Creates the EVM precompile for this type.

Trait Implementations§

Source§

impl ContractStorage for ValidatorConfigV2

Source§

fn address(&self) -> Address

Contract address.
Source§

fn storage(&self) -> &StorageCtx

Contract storage accessor.
Source§

fn storage_mut(&mut self) -> &mut StorageCtx

Contract storage mutable accessor.
Source§

fn is_initialized(&self) -> Result<bool>

Returns true if the contract has been initialized (has bytecode deployed).
Source§

impl Default for ValidatorConfigV2

Source§

fn default() -> Self

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

impl Precompile for ValidatorConfigV2

Source§

fn call(&mut self, calldata: &[u8], msg_sender: Address) -> PrecompileResult

Dispatches an EVM call to this precompile. Read more

Auto Trait Implementations§

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> 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<TxEnv, T> FromRecoveredTx<&T> for TxEnv
where TxEnv: FromRecoveredTx<T>,

§

fn from_recovered_tx(tx: &&T, sender: Address) -> TxEnv

Builds a [TxEnv] from a transaction and a sender address.
§

impl<TxEnv, T> FromTxWithEncoded<&T> for TxEnv
where TxEnv: FromTxWithEncoded<T>,

§

fn from_encoded_tx(tx: &&T, sender: Address, encoded: Bytes) -> TxEnv

Builds a [TxEnv] from a transaction, its sender, and encoded transaction bytes.
§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

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
§

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> 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: 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: 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> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn propagate_header(self, header: HeaderName) -> PropagateHeader<Self>
where Self: Sized,

Available on crate feature propagate-header only.
Propagate a header from the request to the response. Read more
§

fn add_extension<T>(self, value: T) -> AddExtension<Self, T>
where Self: Sized,

Available on crate feature add-extension only.
Add some shareable value to request extensions. Read more
§

fn map_request_body<F>(self, f: F) -> MapRequestBody<Self, F>
where Self: Sized,

Available on crate feature map-request-body only.
Apply a transformation to the request body. Read more
§

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Available on crate feature map-response-body only.
Apply a transformation to the response body. Read more
§

fn compression(self) -> Compression<Self>
where Self: Sized,

Available on crate features compression-br or compression-deflate or compression-gzip or compression-zstd only.
Compresses response bodies. Read more
§

fn decompression(self) -> Decompression<Self>
where Self: Sized,

Available on crate features decompression-br or decompression-deflate or decompression-gzip or decompression-zstd only.
Decompress response bodies. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

Available on crate feature trace only.
High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

Available on crate feature trace only.
High level tracing that classifies responses using gRPC headers. Read more
§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Available on crate feature follow-redirect only.
Follow redirect resposes using the Standard policy. Read more
§

fn sensitive_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>
where Self: Sized,

Available on crate feature sensitive-headers only.
Mark headers as sensitive on both requests and responses. Read more
§

fn sensitive_request_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveRequestHeaders<Self>
where Self: Sized,

Available on crate feature sensitive-headers only.
Mark headers as sensitive on requests. Read more
§

fn sensitive_response_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveResponseHeaders<Self>
where Self: Sized,

Available on crate feature sensitive-headers only.
Mark headers as sensitive on responses. Read more
§

fn override_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Available on crate feature set-header only.
Insert a header into the request. Read more
§

fn append_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Available on crate feature set-header only.
Append a header into the request. Read more
§

fn insert_request_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Available on crate feature set-header only.
Insert a header into the request, if the header is not already present. Read more
§

fn override_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Available on crate feature set-header only.
Insert a header into the response. Read more
§

fn append_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Available on crate feature set-header only.
Append a header into the response. Read more
§

fn insert_response_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Available on crate feature set-header only.
Insert a header into the response, if the header is not already present. Read more
§

fn set_request_id<M>( self, header_name: HeaderName, make_request_id: M, ) -> SetRequestId<Self, M>
where Self: Sized, M: MakeRequestId,

Available on crate feature request-id only.
Add request id header and extension. Read more
§

fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>
where Self: Sized, M: MakeRequestId,

Available on crate feature request-id only.
Add request id header and extension, using x-request-id as the header name. Read more
§

fn propagate_request_id( self, header_name: HeaderName, ) -> PropagateRequestId<Self>
where Self: Sized,

Available on crate feature request-id only.
Propgate request ids from requests to responses. Read more
§

fn propagate_x_request_id(self) -> PropagateRequestId<Self>
where Self: Sized,

Available on crate feature request-id only.
Propgate request ids from requests to responses, using x-request-id as the header name. Read more
§

fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>
where Self: Sized,

Available on crate feature catch-panic only.
Catch panics and convert them into 500 Internal Server responses. Read more
§

fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>
where Self: Sized,

Available on crate feature limit only.
Intercept requests with over-sized payloads and convert them into 413 Payload Too Large responses. Read more
§

fn trim_trailing_slash(self) -> NormalizePath<Self>
where Self: Sized,

Available on crate feature normalize-path only.
Remove trailing slashes from paths. Read more
§

fn append_trailing_slash(self) -> NormalizePath<Self>
where Self: Sized,

Available on crate feature normalize-path only.
Append trailing slash to paths. 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
§

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

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 1024 bytes