Skip to main content

Authenticator

Struct Authenticator 

Source
pub struct Authenticator {
    pub config: Config,
    pub packed_account_data: Uint<256, 4>,
    /* private fields */
}
Expand description

An Authenticator is the agent of a user interacting with the World ID Protocol.

§Definition

A software or hardware agent (e.g., app, device, web client, or service) that controls a set of authorized keypairs for a World ID Account and is functionally capable of interacting with the Protocol, and is therefore permitted to act on that account’s behalf. An Authenticator is the agent of users/holders. Each Authenticator is registered in the WorldIDRegistry through their authorized keypairs.

For example, an Authenticator can live in a mobile wallet or a web application.

Fields§

§config: Config

General configuration for the Authenticator.

§packed_account_data: Uint<256, 4>

The packed account data for the holder’s World ID is a uint256 defined in the WorldIDRegistry contract as: recovery_counter (32 bits) | pubkey_id (commitment to all off-chain public keys) (32 bits) | leaf_index (192 bits)

Implementations§

Source§

impl Authenticator

Source

pub async fn init( seed: &[u8], config: Config, ) -> Result<Authenticator, AuthenticatorError>

Initialize an Authenticator from a seed and config.

This method requires the authenticator address derived from seed to already be present on-chain in the WorldIDRegistry.

If no account exists for that authenticator, it returns AuthenticatorError::AccountDoesNotExist. The same error can also occur transiently while a create-account or authenticator-management operation is still pending on-chain and the authenticator address has not been registered yet. Consumers that are coordinating such operations should poll the gateway request and retry initialization after finalization.

Indexer DB catch-up is separate and does not block initialization, since packed account data is read from the registry (directly or via the indexer’s chain-backed packed-account endpoint).

§Errors
  • Will error if the provided seed is invalid (not 32 bytes).
  • Will error if the RPC URL is invalid.
  • Will error if there are contract call failures.
  • Will return AuthenticatorError::AccountDoesNotExist if the authenticator address derived from seed is not currently registered on-chain, whether permanently or because a relevant on-chain operation has not finalized yet.
Source

pub fn with_proof_materials( self, query_material: Arc<CircomGroth16Material>, nullifier_material: Arc<CircomGroth16Material>, ) -> Authenticator

Sets the proof materials for the Authenticator, returning a new instance.

Proof materials are required for proof generation, blinding factors and starting sessions. Given the proof circuits are large, this may be loaded only when necessary.

Source

pub async fn register( seed: &[u8], config: Config, recovery_address: Option<Address>, ) -> Result<InitializingAuthenticator, AuthenticatorError>

Registers a new World ID in the WorldIDRegistry.

Given the registration process is asynchronous, this method will return a InitializingAuthenticator object.

§Errors
  • See init for additional error details.
Source

pub async fn init_or_register( seed: &[u8], config: Config, recovery_address: Option<Address>, ) -> Result<Authenticator, AuthenticatorError>

Initializes (if the World ID already exists in the registry) or registers a new World ID.

The registration process is asynchronous and may take some time. This method will block the thread until the registration is in a final state (success or terminal error). For better user experience in end authenticator clients, it is recommended to implement custom polling logic.

Explicit init or register calls are also recommended as the authenticator should know if a new World ID should be truly created. For example, an authenticator may have been revoked access to an existing World ID.

§Errors
  • See init for additional error details.
Source

pub async fn fetch_packed_account_data( &self, ) -> Result<Uint<256, 4>, AuthenticatorError>

Fetches the packed account data for this authenticator from the indexer or registry without mutating local state.

§Errors

Will error if the network call fails or if the account does not exist.

Source

pub async fn refresh_packed_account_data( &mut self, ) -> Result<Uint<256, 4>, AuthenticatorError>

Re-fetches the packed account data for this authenticator and updates local state.

§Errors

Will error if the network call fails or if the account does not exist.

Source

pub const fn onchain_address(&self) -> Address

Returns the k256 public key of the Authenticator signer which is used to verify on-chain operations, chiefly with the WorldIdRegistry contract.

Source

pub fn offchain_pubkey(&self) -> EdDSAPublicKey

Returns the EdDSA public key of the Authenticator signer which is used to verify off-chain operations. For example, the Nullifier Oracle uses it to verify requests for nullifiers.

Source

pub fn offchain_pubkey_compressed( &self, ) -> Result<Uint<256, 4>, AuthenticatorError>

Returns the compressed EdDSA public key of the Authenticator signer which is used to verify off-chain operations. For example, the Nullifier Oracle uses it to verify requests for nullifiers.

§Errors

Will error if the public key cannot be serialized.

Source

pub fn registry(&self) -> Option<Arc<WorldIdRegistryInstance<DynProvider>>>

Returns a reference to the WorldIdRegistry contract instance.

Source

pub fn leaf_index(&self) -> u64

Returns the index for the holder’s World ID.

§Definition

The leaf_index is the main (internal) identifier of a World ID. It is registered in the WorldIDRegistry and represents the index at the Merkle tree where the World ID resides.

§Notes
  • The leaf_index is used as input in the nullifier generation, ensuring a nullifier will always be the same for the same RP context and the same World ID (allowing for uniqueness).
  • The leaf_index is generally not exposed outside Authenticators. It is not a secret because it’s not exposed to RPs outside ZK-circuits, but the only acceptable exposure outside an Authenticator is to fetch Merkle inclusion proofs from an indexer or it may create a pseudonymous identifier.
  • The leaf_index is stored as a uint64 inside packed account data.
Source

pub fn recovery_counter(&self) -> Uint<256, 4>

Returns the recovery counter for the holder’s World ID.

The recovery counter is used to efficiently invalidate all the old keys when an account is recovered.

Source

pub fn pubkey_id(&self) -> Uint<256, 4>

Returns the pubkey id (or commitment) for the holder’s World ID.

This is a commitment to all the off-chain public keys that are authorized to act on behalf of the holder.

Source

pub async fn fetch_inclusion_proof( &self, ) -> Result<AccountInclusionProof<world_id_authenticator::::authenticator::{impl#1}::fetch_inclusion_proof::{constant#1}>, AuthenticatorError>

Fetches a Merkle inclusion proof for the holder’s World ID given their account index.

§Errors
  • Will error if the provided indexer URL is not valid or if there are HTTP call failures.
  • Will error if the user is not registered on the WorldIDRegistry.
Source

pub async fn fetch_authenticator_pubkeys( &self, ) -> Result<AuthenticatorPublicKeySet, AuthenticatorError>

Fetches the current authenticator public key set for the account.

This is used by mutation operations to compute old/new offchain signer commitments without requiring Merkle proof generation.

§Errors
  • Will error if the provided indexer URL is not valid or if there are HTTP call failures.
  • Will error if the user is not registered on the WorldIDRegistry.
Source

pub async fn signing_nonce(&self) -> Result<Uint<256, 4>, AuthenticatorError>

Returns the signing nonce for the holder’s World ID.

§Errors

Will return an error if the registry contract call fails.

Source

pub fn danger_sign_challenge( &self, challenge: &[u8], ) -> Result<Signature, AuthenticatorError>

Signs an arbitrary challenge with the authenticator’s on-chain key following ERC-191.

§Warning

This is considered a dangerous operation because it leaks the user’s on-chain key, hence its leaf_index. The only acceptable use is to prove the user’s leaf_index to a Recovery Agent. The Recovery Agent is the only party beyond the user who needs to know the leaf_index.

§Use
  • This method is used to prove ownership over a leaf index only for Recovery Agents.
Source§

impl Authenticator

Source

pub async fn insert_authenticator( &self, new_authenticator_pubkey: EdDSAPublicKey, new_authenticator_address: Address, ) -> Result<GatewayRequestId, AuthenticatorError>

Inserts a new authenticator to the account.

§Errors

Will error if the provided RPC URL is not valid or if there are HTTP call failures.

§Note

Inserting another authenticator changes the account’s off-chain signer commitment, but does not change this authenticator’s own packed_account_data. Indexer-backed account views may remain stale until the gateway request finalizes and the indexer catches up.

Source

pub async fn update_authenticator( &self, old_authenticator_address: Address, new_authenticator_address: Address, new_authenticator_pubkey: EdDSAPublicKey, index: u32, ) -> Result<GatewayRequestId, AuthenticatorError>

Updates an existing authenticator slot with a new authenticator.

§Errors

Returns an error if the gateway rejects the request or a network error occurs.

§Note

After this request finalizes on-chain, the current Authenticator may become unusable if it corresponds to the authenticator being updated. Consumers should poll the gateway request and re-initialize the appropriate authenticator as needed.

Source

pub async fn remove_authenticator( &self, authenticator_address: Address, index: u32, ) -> Result<GatewayRequestId, AuthenticatorError>

Removes an authenticator from the account.

§Errors

Returns an error if the gateway rejects the request or a network error occurs.

§Note

After this request finalizes on-chain, the current Authenticator may become unusable if it corresponds to the authenticator being removed. Consumers should poll the gateway request and re-initialize or discard this authenticator as needed.

Source

pub async fn poll_status( &self, request_id: &GatewayRequestId, ) -> Result<GatewayRequestState, AuthenticatorError>

Polls the gateway for the current status of a previously submitted request.

Use the GatewayRequestId returned by insert_authenticator, update_authenticator, or remove_authenticator to track the operation.

§Errors
  • Will error if the network request fails.
  • Will error if the gateway returns an error response (e.g. request not found).
Source§

impl Authenticator

Source

pub async fn generate_nullifier( &self, proof_request: &ProofRequest, account_inclusion_proof: Option<AccountInclusionProof<world_id_authenticator::::prove::{impl#0}::generate_nullifier::{constant#0}>>, ) -> Result<FullOprfOutput, AuthenticatorError>

Generates a nullifier for a World ID Proof (through OPRF Nodes).

A Nullifier is a unique, one-time use, anonymous identifier for a World ID on a specific RP context. See Nullifier for more details.

§Arguments
  • proof_request: the request received from the RP.
  • account_inclusion_proof: an optionally cached object can be passed to avoid an additional network call. If not passed, it’ll be fetched from the indexer.

A Nullifier takes an action as input:

  • If proof_request is for a Session Proof, a random internal action is generated. This is opaque to RPs, and verified internally in the verification contract.
  • If proof_request is for a Uniqueness Proof, the action is provided by the RP, if not provided a default of FieldElement::ZERO is used.
§Errors
  • Will raise a ProofError if there is any issue generating the nullifier. For example, network issues, unexpected incorrect responses from OPRF Nodes.
  • Raises an error if the OPRF Nodes configuration is not correctly set.
Source

pub async fn generate_credential_blinding_factor( &self, issuer_schema_id: u64, ) -> Result<FieldElement, AuthenticatorError>

Generates a blinding factor for a Credential sub (through OPRF Nodes). The credential blinding factor enables every credential to have a different subject identifier, see Credential::sub for more details.

§Errors
  • Will raise a ProofError if there is any issue generating the blinding factor. For example, network issues, unexpected incorrect responses from OPRF Nodes.
  • Raises an error if the OPRF Nodes configuration is not correctly set.
Source

pub async fn build_session_id( &self, proof_request: &ProofRequest, session_id_r_seed: Option<FieldElement>, account_inclusion_proof: Option<AccountInclusionProof<world_id_authenticator::::prove::{impl#0}::build_session_id::{constant#0}>>, ) -> Result<(SessionId, FieldElement), AuthenticatorError>

Builds or resolves a SessionId object which can be used for Session Proofs. This has two uses:

  1. Creating a new Session, i.e. generating a SessionId for the first time.
  2. Reconstructing a session for a Session Proof, particularly if the session_id_r_seed is not cached.

Internally, this derives the session randomness (r) using OPRF Nodes. For existing sessions this re-derives the same r from SessionId::oprf_seed; it does not mint a new session. The seed is used to compute the SessionId::commitment for Session Proofs.

§Arguments
  • proof_request: the request received from the RP to create or prove a session id.
  • session_id_r_seed: the seed (see below) if it was already generated previously and it’s cached.
  • account_inclusion_proof: an optionally cached object can be passed to avoid an additional network call. If not passed, it’ll be fetched from the indexer.
§Returns
  • session_id: The generated or resolved SessionId.
  • session_id_r_seed: The r value used for this session so the Authenticator can cache it.
§Seed (session_id_r_seed)
  • If a session_id_r_seed (r) is not provided, it’ll be derived/re-derived with the OPRF nodes.
  • Even if r has been generated before, the same r will be computed again for the same context (i.e. rpId, SessionId::oprf_seed). This means caching r is optional but RECOMMENDED.
  • Caching behavior is the responsibility of the Authenticator (and/or its relevant SDKs), not this crate.
  • More information about the seed can be found in SessionId::from_r_seed.
Source

pub async fn generate_proof( &self, proof_request: &ProofRequest, nullifier: FullOprfOutput, credentials: &[CredentialInput], account_inclusion_proof: Option<AccountInclusionProof<world_id_authenticator::::prove::{impl#0}::generate_proof::{constant#0}>>, session_id_r_seed: Option<FieldElement>, ) -> Result<ProofResult, AuthenticatorError>

Generates a complete ProofResponse for the given ProofRequest to respond to an RP request.

This orchestrates session resolution, per-credential proof generation, response assembly, and self-validation.

§Typical flow
// <- check request can be fulfilled with available credentials
let nullifier = authenticator.generate_nullifier(&request, None).await?;
// <- check replay guard using nullifier.oprf_output()
let (response, meta) = authenticator.generate_proof(&request, nullifier, &creds, ...).await?;
// <- cache `session_id_r_seed` (to speed future proofs) and `nullifier` (to prevent replays)
§Arguments
  • proof_request — the RP’s full request.
  • nullifier — the OPRF nullifier output, obtained from generate_nullifier. The caller MUST check for replays before calling this method to avoid wasted computation.
  • credentials — one CredentialInput per credential to prove, matched to request items by issuer_schema_id.
  • account_inclusion_proof — a cached inclusion proof if available (a fresh one will be fetched otherwise)
  • session_id_r_seed — a cached session r seed for Session Proofs. If not available, it will be re-computed.
§Caller Responsibilities
  1. The caller must ensure the request can be fulfilled with the credentials which the user has available, and provide such credentials.
  2. The caller must ensure the nullifier has not been used before.
§Errors
Source

pub async fn prove_credential_sub( &self, nonce: FieldElement, credential_blinding_factor: FieldElement, sub: FieldElement, account_inclusion_proof: Option<AccountInclusionProof<world_id_authenticator::::prove::{impl#0}::prove_credential_sub::{constant#0}>>, ) -> Result<OwnershipProof, AuthenticatorError>

Generates an Ownership Proof (WIP-103) over a Credential’s sub.

This proof MUST only be shared with each relevant issuer. This is the responsibility of Authenticators.

§Arguments
  • nonce: The nonce of the request provided by the Issuer.
  • credential_blinding_factor: The blinding factor generated for the credential.
  • sub: The expected sub of the Credential in question.
  • account_inclusion_proof: An optionally cached account inclusion proof. If not provided, a new inclusion proof will be fetched.
§Returns

The OwnershipProof containing the ZKP and Merkle root.

Source§

impl Authenticator

Source

pub async fn initiate_recovery_agent_update( &self, new_recovery_agent: Address, ) -> Result<GatewayRequestId, AuthenticatorError>

👎Deprecated:

WIP-102: use update_recovery_agent. The legacy URL still works against a V2-upgraded gateway, but the V2 contract changes the agent immediately (with a revert window) instead of starting a cooldown.

Initiates a recovery agent update for the holder’s World ID.

This begins a time-locked process to change the recovery agent. The update must be executed after a cooldown period using execute_recovery_agent_update, or it can be cancelled using cancel_recovery_agent_update.

§Errors

Returns an error if the gateway rejects the request or a network error occurs.

Source

pub async fn danger_sign_initiate_recovery_agent_update( &self, new_recovery_agent: Address, ) -> Result<(Signature, Uint<256, 4>), AuthenticatorError>

Signs the EIP-712 InitiateRecoveryAgentUpdate payload and returns the signature without submitting anything to the gateway.

This is the signing-only counterpart of Self::initiate_recovery_agent_update. Callers can use the returned signature to build and submit the gateway request themselves.

§Warning

This method uses the onchain_signer (secp256k1 ECDSA) and produces a recoverable signature. Any holder of the signature together with the EIP-712 parameters can call ecrecover to obtain the onchain_address, which can then be looked up in the registry to derive the user’s leaf_index. Only expose the output to trusted parties (e.g. a Recovery Agent).

§Errors

Returns an error if the nonce fetch or signing step fails.

Source

pub async fn update_recovery_agent( &self, new_recovery_agent: Address, ) -> Result<GatewayRequestId, AuthenticatorError>

Updates the holder’s recovery agent (WIP-102).

On a V2 registry the new agent becomes effective immediately, but for a revert window (getRecoveryAgentUpdateCooldown seconds) any authenticator can call Self::revert_recovery_agent_update to roll back. During that window the previous agent remains the only valid signer for recoverAccount, which mitigates a compromised authenticator silently swapping in an attacker-controlled recovery address.

§Errors

Returns an error if the gateway rejects the request or a network error occurs.

Source

pub async fn execute_recovery_agent_update( &self, ) -> Result<GatewayRequestId, AuthenticatorError>

👎Deprecated:

WIP-102: this operation no longer exists. On a V2-upgraded gateway the call is a no-op (returns Finalized without touching chain). Remove the call from your flow.

Executes a pending recovery agent update for the holder’s World ID.

This is a permissionless operation that can be called by anyone after the cooldown period has elapsed. No signature is required.

§Errors

Returns an error if the gateway rejects the request or a network error occurs.

Source

pub async fn cancel_recovery_agent_update( &self, ) -> Result<GatewayRequestId, AuthenticatorError>

👎Deprecated:

WIP-102: use revert_recovery_agent_update. The legacy URL still works against a V2-upgraded gateway, but the new method name reflects WIP-102 semantics: the operation can only succeed within the revert window after update_recovery_agent.

Cancels a pending recovery agent update for the holder’s World ID.

§Errors

Returns an error if the gateway rejects the request or a network error occurs.

Source

pub async fn revert_recovery_agent_update( &self, ) -> Result<GatewayRequestId, AuthenticatorError>

Reverts an in-flight recovery agent update during the revert window (WIP-102).

§Errors

Returns an error if the gateway rejects the request or a network error occurs.

Trait Implementations§

Source§

impl Debug for Authenticator

Source§

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

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

impl ProtocolSigner for Authenticator

Source§

fn sign(&self, message: FieldElement) -> EdDSASignature

Signs a message with the protocol signer using the EdDSA scheme (off-chain signer), for use with the Protocol ZK circuits.

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

impl<T> Layering for T

Source§

fn add_layer<L, F>(self, other: L) -> Layer<L, T>

Layer an executor on top of this one. The other executor will be called first.
Source§

impl<D> OwoColorize for D

Source§

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

Set the foreground color generically Read more
Source§

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

Set the background color generically. Read more
Source§

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

Change the foreground color to black
Source§

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

Change the background color to black
Source§

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

Change the foreground color to red
Source§

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

Change the background color to red
Source§

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

Change the foreground color to green
Source§

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

Change the background color to green
Source§

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

Change the foreground color to yellow
Source§

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

Change the background color to yellow
Source§

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

Change the foreground color to blue
Source§

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

Change the background color to blue
Source§

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

Change the foreground color to magenta
Source§

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

Change the background color to magenta
Source§

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

Change the foreground color to purple
Source§

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

Change the background color to purple
Source§

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

Change the foreground color to cyan
Source§

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

Change the background color to cyan
Source§

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

Change the foreground color to white
Source§

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

Change the background color to white
Source§

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

Change the foreground color to the terminal default
Source§

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

Change the background color to the terminal default
Source§

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

Change the foreground color to bright black
Source§

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

Change the background color to bright black
Source§

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

Change the foreground color to bright red
Source§

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

Change the background color to bright red
Source§

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

Change the foreground color to bright green
Source§

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

Change the background color to bright green
Source§

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

Change the foreground color to bright yellow
Source§

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

Change the background color to bright yellow
Source§

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

Change the foreground color to bright blue
Source§

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

Change the background color to bright blue
Source§

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

Change the foreground color to bright magenta
Source§

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

Change the background color to bright magenta
Source§

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

Change the foreground color to bright purple
Source§

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

Change the background color to bright purple
Source§

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

Change the foreground color to bright cyan
Source§

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

Change the background color to bright cyan
Source§

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

Change the foreground color to bright white
Source§

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

Change the background color to bright white
Source§

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

Make the text bold
Source§

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

Make the text dim
Source§

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

Make the text italicized
Source§

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

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

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

Swap the foreground and background colors
Source§

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

Hide the text
Source§

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

Cross out the text
Source§

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

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

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

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

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

Sets the foreground color to an RGB value.
Source§

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

Sets the background color to an RGB value.
Source§

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

Apply a runtime-determined style
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: 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: 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
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

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

impl<T> MaybeSend for T
where T: Send,