Struct TipFeeManager
pub struct TipFeeManager {
pub validator_tokens: <Mapping<Address, Address> as StorableType>::Handler,
pub user_tokens: <Mapping<Address, Address> as StorableType>::Handler,
pub collected_fees: <Mapping<Address, Mapping<Address, Uint<256, 4>>> as StorableType>::Handler,
pub pools: <Mapping<FixedBytes<32>, Pool> as StorableType>::Handler,
pub total_supply: <Mapping<FixedBytes<32>, Uint<256, 4>> as StorableType>::Handler,
pub liquidity_balances: <Mapping<FixedBytes<32>, Mapping<Address, Uint<256, 4>>> as StorableType>::Handler,
pub pending_fee_swap_reservation: <Mapping<FixedBytes<32>, u128> as StorableType>::Handler,
pub two_hop_intermediate: <Address as StorableType>::Handler,
address: Address,
storage: StorageCtx,
}Fields§
§validator_tokens: <Mapping<Address, Address> as StorableType>::Handler§user_tokens: <Mapping<Address, Address> as StorableType>::Handler§collected_fees: <Mapping<Address, Mapping<Address, Uint<256, 4>>> as StorableType>::Handler§pools: <Mapping<FixedBytes<32>, Pool> as StorableType>::Handler§total_supply: <Mapping<FixedBytes<32>, Uint<256, 4>> as StorableType>::Handler§liquidity_balances: <Mapping<FixedBytes<32>, Mapping<Address, Uint<256, 4>>> as StorableType>::Handler§pending_fee_swap_reservation: <Mapping<FixedBytes<32>, u128> as StorableType>::Handler§two_hop_intermediate: <Address as StorableType>::Handler§address: Address§storage: StorageCtxImplementations§
§impl TipFeeManager
impl TipFeeManager
pub fn pool_id(
&self,
user_token: Address,
validator_token: Address,
) -> FixedBytes<32>
pub fn pool_id( &self, user_token: Address, validator_token: Address, ) -> FixedBytes<32>
Returns the deterministic pool ID for a directional token pair. Note that the pool id is
order-dependent: (A, B) produces a different ID than (B, A).
pub fn get_pool(&self, call: getPoolCall) -> Result<Pool, TempoPrecompileError>
pub fn get_pool(&self, call: getPoolCall) -> Result<Pool, TempoPrecompileError>
Returns the [Pool] reserves for the given user/validator token pair.
pub fn reserve_pool_liquidity(
&mut self,
pool_id: FixedBytes<32>,
amount: u128,
) -> Result<(), TempoPrecompileError>
pub fn reserve_pool_liquidity( &mut self, pool_id: FixedBytes<32>, amount: u128, ) -> Result<(), TempoPrecompileError>
Reserves pool liquidity in transient storage for a pending fee swap.
pub fn rebalance_swap(
&mut self,
msg_sender: Address,
user_token: Address,
validator_token: Address,
amount_out: Uint<256, 4>,
to: Address,
) -> Result<Uint<256, 4>, TempoPrecompileError>
pub fn rebalance_swap( &mut self, msg_sender: Address, user_token: Address, validator_token: Address, amount_out: Uint<256, 4>, to: Address, ) -> Result<Uint<256, 4>, TempoPrecompileError>
Executes a rebalance swap: sells amount_out of user-token from the pool in exchange for
validator-token at the rebalance rate (N / SCALE). Used by arbitrageurs to rebalance reserves.
§Errors
InvalidAmount—amount_outis zero or exceedsu128InsufficientReserves— addingamount_inoverflows the validator reserveInsufficientLiquidity— remaining reserve would violate the pending reservation (T1C+)UnderOverflow— arithmetic overflow computingamount_in
pub fn mint(
&mut self,
msg_sender: Address,
user_token: Address,
validator_token: Address,
amount_validator_token: Uint<256, 4>,
to: Address,
) -> Result<Uint<256, 4>, TempoPrecompileError>
pub fn mint( &mut self, msg_sender: Address, user_token: Address, validator_token: Address, amount_validator_token: Uint<256, 4>, to: Address, ) -> Result<Uint<256, 4>, TempoPrecompileError>
Mints LP tokens by depositing validator-token into a pool.
On first deposit the pool is initialized with equal reserves and [MIN_LIQUIDITY] is
permanently locked. Subsequent deposits mint pro-rata to existing supply. Both tokens
must be distinct, USD-denominated TIP-20s.
NOTE: Validators who also provide liquidity have an information advantage over non-validator LPs. Because validators choose their preferred fee token and control transaction inclusion order as block producers, a validator-LP can predict which pool will receive fee-swap revenue and position liquidity accordingly.
§Errors
IdenticalAddresses—user_tokenequalsvalidator_tokenInvalidAmount—amount_validator_tokenis zero or exceedsu128InvalidCurrency— either token is not USD-denominatedInsufficientLiquidity— initial deposit ≤MIN_LIQUIDITY, or zero liquidity mintedInvalidSwapCalculation— pro-rata arithmetic failsUnderOverflow— supply or balance overflow
pub fn burn(
&mut self,
msg_sender: Address,
user_token: Address,
validator_token: Address,
liquidity: Uint<256, 4>,
to: Address,
) -> Result<(Uint<256, 4>, Uint<256, 4>), TempoPrecompileError>
pub fn burn( &mut self, msg_sender: Address, user_token: Address, validator_token: Address, liquidity: Uint<256, 4>, to: Address, ) -> Result<(Uint<256, 4>, Uint<256, 4>), TempoPrecompileError>
Burns LP tokens and returns the pro-rata share of both pool tokens to to.
On T1C+ the burn is rejected if the remaining validator-token reserve would fall below
the pending fee-swap reservation set by TipFeeManager::reserve_pool_liquidity.
§Errors
IdenticalAddresses—user_tokenequalsvalidator_tokenInvalidAmount—liquidityis zero or amounts exceedu128InvalidCurrency— either token is not USD-denominatedInsufficientLiquidity— caller’s balance <liquidity, or remaining reserve would violate the pending reservation (T1C+)InsufficientReserves— pool reserves underflow after withdrawalUnderOverflow— supply or balance arithmetic overflows
pub fn plan_fee_route(
&self,
user_token: Address,
validator_token: Address,
max_amount: Uint<256, 4>,
) -> Result<(Option<FeeRoute>, Option<Address>, Vec<((Address, Address), u128)>), TempoPrecompileError>
pub fn plan_fee_route( &self, user_token: Address, validator_token: Address, max_amount: Uint<256, 4>, ) -> Result<(Option<FeeRoute>, Option<Address>, Vec<((Address, Address), u128)>), TempoPrecompileError>
Plans the AMM path needed to swap max_amount of user_token into validator_token
under the active hardfork. Read-only; does not reserve.
On T5+ falls back to a two-hop path through userToken.quoteToken() as per TIP-1033.
Returns (route, queried_intermediate, pools):
routeisNonewhen no path has sufficient liquidity.queried_intermediateisSome(addr)wheneveruserToken.quoteToken()was read, regardless of whether the value is usable. Callers can cache it to skip the cold storage read on subsequent admissions.poolslists every pool slot read during planning, paired with its observed reserve.
§Errors
InvalidToken—user_tokendoes not have a valid TIP-20 prefixUnderOverflow— fee-amount arithmetic overflows
pub fn execute_fee_swap(
&mut self,
user_token: Address,
validator_token: Address,
amount_in: Uint<256, 4>,
) -> Result<Uint<256, 4>, TempoPrecompileError>
pub fn execute_fee_swap( &mut self, user_token: Address, validator_token: Address, amount_in: Uint<256, 4>, ) -> Result<Uint<256, 4>, TempoPrecompileError>
Executes a fee swap, converting user_token to validator_token at a fixed rate m = 0.997
Called internally by TipFeeManager::collect_fee_post_tx during post-tx fee collection.
§Errors
InsufficientLiquidity— pool validator-token reserve is below the required outputUnderOverflow— reserve arithmetic overflows or amounts exceedu128
pub fn get_total_supply(
&self,
pool_id: FixedBytes<32>,
) -> Result<Uint<256, 4>, TempoPrecompileError>
pub fn get_total_supply( &self, pool_id: FixedBytes<32>, ) -> Result<Uint<256, 4>, TempoPrecompileError>
Returns the total supply of LP tokens for the given pool.
pub fn get_liquidity_balances(
&self,
pool_id: FixedBytes<32>,
user: Address,
) -> Result<Uint<256, 4>, TempoPrecompileError>
pub fn get_liquidity_balances( &self, pool_id: FixedBytes<32>, user: Address, ) -> Result<Uint<256, 4>, TempoPrecompileError>
Returns the LP token balance for user in the given pool.
§impl TipFeeManager
impl TipFeeManager
pub fn new() -> TipFeeManager
pub fn new() -> TipFeeManager
Creates an instance of the precompile.
Caution: This does not initialize the account, see Self::initialize.
§impl TipFeeManager
impl TipFeeManager
pub const BASIS_POINTS: u64 = 10000
pub const BASIS_POINTS: u64 = 10000
Basis-point denominator (10 000 = 100%).
pub const MINIMUM_BALANCE: Uint<256, 4>
pub const MINIMUM_BALANCE: Uint<256, 4>
Minimum TIP-20 balance required for fee operations (1e9).
pub fn initialize(&mut self) -> Result<(), TempoPrecompileError>
pub fn initialize(&mut self) -> Result<(), TempoPrecompileError>
Initializes the fee manager precompile.
pub fn get_validator_token(
&self,
beneficiary: Address,
) -> Result<Address, TempoPrecompileError>
pub fn get_validator_token( &self, beneficiary: Address, ) -> Result<Address, TempoPrecompileError>
Returns the validator’s preferred fee token, falling back to [DEFAULT_FEE_TOKEN].
pub fn set_validator_token(
&mut self,
sender: Address,
call: setValidatorTokenCall,
beneficiary: Address,
) -> Result<(), TempoPrecompileError>
pub fn set_validator_token( &mut self, sender: Address, call: setValidatorTokenCall, beneficiary: Address, ) -> Result<(), TempoPrecompileError>
Sets the caller’s preferred fee token as a validator.
Rejects the call if sender is the current block’s beneficiary (prevents mid-block
fee-token changes) or if the token is not a valid USD-denominated TIP-20 registered in
[TIP20Factory].
§Errors
InvalidToken— token is not a deployed TIP-20 in [TIP20Factory]CannotChangeWithinBlock—senderequals the current blockbeneficiaryInvalidCurrency— token is not USD-denominated
pub fn set_user_token(
&mut self,
sender: Address,
call: setUserTokenCall,
) -> Result<(), TempoPrecompileError>
pub fn set_user_token( &mut self, sender: Address, call: setUserTokenCall, ) -> Result<(), TempoPrecompileError>
Sets the caller’s preferred fee token as a user. Must be a valid USD-denominated TIP-20
registered in [TIP20Factory].
§Errors
InvalidToken— token is not a deployed TIP-20 in [TIP20Factory]InvalidCurrency— token is not USD-denominated
pub fn collect_fee_pre_tx(
&mut self,
fee_payer: Address,
user_token: Address,
max_amount: Uint<256, 4>,
beneficiary: Address,
skip_liquidity_check: bool,
) -> Result<Address, TempoPrecompileError>
pub fn collect_fee_pre_tx( &mut self, fee_payer: Address, user_token: Address, max_amount: Uint<256, 4>, beneficiary: Address, skip_liquidity_check: bool, ) -> Result<Address, TempoPrecompileError>
Collects fees from fee_payer before transaction execution.
Transfers max_amount of user_token to the fee manager via [TIP20Token] and, if the
validator prefers a different token, verifies sufficient pool liquidity.
Reserves liquidity on T1C+, with a two-hop fallback through userToken.quoteToken() on T5+.
Returns the user’s fee token.
§Errors
InvalidToken—user_tokendoes not have a valid TIP-20 prefixPolicyForbids— TIP-403 policy rejects the fee token transferInsufficientLiquidity— AMM pool lacks liquidity for the fee swap (T5+: with two-hop fallback)
pub fn collect_fee_post_tx(
&mut self,
fee_payer: Address,
actual_spending: Uint<256, 4>,
refund_amount: Uint<256, 4>,
fee_token: Address,
beneficiary: Address,
) -> Result<Uint<256, 4>, TempoPrecompileError>
pub fn collect_fee_post_tx( &mut self, fee_payer: Address, actual_spending: Uint<256, 4>, refund_amount: Uint<256, 4>, fee_token: Address, beneficiary: Address, ) -> Result<Uint<256, 4>, TempoPrecompileError>
Finalizes fee collection after transaction execution.
Refunds unused user_token to fee_payer via [TIP20Token], executes the fee swap
through the AMM pool if tokens differ, and accumulates fees for the validator. Returns
the validator-credited amount (post-feeAMM haircut, in the validator’s fee token), which
is used by the payload builder to score blocks by actual proposer revenue.
§Errors
InvalidToken—fee_tokendoes not have a valid TIP-20 prefixInsufficientLiquidity— AMM pool lacks liquidity for the fee swapUnderOverflow— collected-fee accumulator overflows
pub fn distribute_fees(
&mut self,
validator: Address,
token: Address,
) -> Result<(), TempoPrecompileError>
pub fn distribute_fees( &mut self, validator: Address, token: Address, ) -> Result<(), TempoPrecompileError>
Transfers a validator’s accumulated fee balance to their address via [TIP20Token] and
zeroes the ledger. No-ops when the balance is zero.
§Errors
InvalidToken—tokendoes not have a valid TIP-20 prefix
pub fn user_tokens(
&self,
call: userTokensCall,
) -> Result<Address, TempoPrecompileError>
pub fn user_tokens( &self, call: userTokensCall, ) -> Result<Address, TempoPrecompileError>
Reads the stored fee token preference for a user.
§impl TipFeeManager
impl TipFeeManager
pub fn create_precompile(cfg: &CfgEnv<TempoHardfork>) -> DynPrecompile
pub fn create_precompile(cfg: &CfgEnv<TempoHardfork>) -> DynPrecompile
Creates the EVM precompile for this type.
Trait Implementations§
§impl ContractStorage for TipFeeManager
impl ContractStorage for TipFeeManager
§fn storage_mut(&mut self) -> &mut StorageCtx
fn storage_mut(&mut self) -> &mut StorageCtx
§fn is_initialized(&self) -> Result<bool, TempoPrecompileError>
fn is_initialized(&self) -> Result<bool, TempoPrecompileError>
§impl Default for TipFeeManager
impl Default for TipFeeManager
§fn default() -> TipFeeManager
fn default() -> TipFeeManager
§impl Precompile for TipFeeManager
impl Precompile for TipFeeManager
§fn call(
&mut self,
calldata: &[u8],
msg_sender: Address,
) -> Result<PrecompileOutput, PrecompileError>
fn call( &mut self, calldata: &[u8], msg_sender: Address, ) -> Result<PrecompileOutput, PrecompileError>
Auto Trait Implementations§
impl !Freeze for TipFeeManager
impl !RefUnwindSafe for TipFeeManager
impl !Sync for TipFeeManager
impl Send for TipFeeManager
impl Unpin for TipFeeManager
impl UnsafeUnpin for TipFeeManager
impl UnwindSafe for TipFeeManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Conv for T
impl<T> Conv for T
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<TxEnv, T> FromRecoveredTx<&T> for TxEnvwhere
TxEnv: FromRecoveredTx<T>,
impl<TxEnv, T> FromRecoveredTx<&T> for TxEnvwhere
TxEnv: FromRecoveredTx<T>,
§fn from_recovered_tx(tx: &&T, sender: Address) -> TxEnv
fn from_recovered_tx(tx: &&T, sender: Address) -> TxEnv
TxEnv from a transaction and a sender address.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
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,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
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>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
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) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
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
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
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
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
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
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.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
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.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
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.§impl<T> TryConv for T
impl<T> TryConv for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
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: 816 bytes