pub struct TransactionContextImpl { /* private fields */ }Expand description
In-scope state for a single
with_contract_scoped_transaction invocation.
All mutable state is behind a Mutex so callbacks can call methods
through a shared &Self reference, matching the TS pattern of
passing txCtx to closures that update it.
Implementations§
Source§impl TransactionContextImpl
impl TransactionContextImpl
Sourcepub fn new(
providers: Arc<ErasedProviders>,
options: ScopedTransactionOptions,
) -> Self
pub fn new( providers: Arc<ErasedProviders>, options: ScopedTransactionOptions, ) -> Self
Construct a new transaction context bound to providers.
Port of TS new TransactionContextImpl(providers, options?).
Sourcepub fn providers(&self) -> &Arc<ErasedProviders> ⓘ
pub fn providers(&self) -> &Arc<ErasedProviders> ⓘ
Returns the providers bundle this scope is bound to.
Sourcepub fn get_additional_mappings(
&self,
) -> Option<&HashMap<CoinPublicKey, EncPublicKey>>
pub fn get_additional_mappings( &self, ) -> Option<&HashMap<CoinPublicKey, EncPublicKey>>
Returns the scope’s optional additional_coin_enc_public_key_mappings.
Port of TS getAdditionalMappings().
Sourcepub fn cache_states(&self, states: CachedStates, identity: CachedStateIdentity)
pub fn cache_states(&self, states: CachedStates, identity: CachedStateIdentity)
Cache the contract / private states under identity for the
rest of the scope. Port of TS [CacheStates]. Overwrites any
previously cached states.
Sourcepub fn cache_states_at(
&self,
states: CachedStates,
identity: CachedStateIdentity,
block_hash: Option<BlockHash>,
)
pub fn cache_states_at( &self, states: CachedStates, identity: CachedStateIdentity, block_hash: Option<BlockHash>, )
Like Self::cache_states, recording the block the states were
read at: later calls in the scope read their callees at the same
block, so the whole scope sees one chain snapshot.
Sourcepub fn cached_block_hash(&self) -> Option<BlockHash>
pub fn cached_block_hash(&self) -> Option<BlockHash>
The block the cached states were read at, when it was recorded.
Sourcepub fn get_current_states_for_identity(
&self,
identity: &CachedStateIdentity,
) -> Result<Option<CachedStates>>
pub fn get_current_states_for_identity( &self, identity: &CachedStateIdentity, ) -> Result<Option<CachedStates>>
Look up the cached states only if identity matches the
identity originally cached. Returns None if nothing is
cached; raises ContractsError::ScopedTransactionIdentityMismatch
when a mismatched identity is supplied. Port of TS
[GetCurrentStatesForIdentity](identity).
Sourcepub fn get_current_states(&self) -> Option<CachedStates>
pub fn get_current_states(&self) -> Option<CachedStates>
Bypass-identity accessor — returns whatever’s cached. Port of
TS getCurrentStates(). Marked deprecated in TS because it
can return states from a different contract; preserved here
for parity. Prefer Self::get_current_states_for_identity.
Sourcepub fn get_last_unsubmitted_call_tx_data_to_transact(
&self,
) -> Option<(UnsubmittedCallTxData, Option<PrivateStateId>)>
pub fn get_last_unsubmitted_call_tx_data_to_transact( &self, ) -> Option<(UnsubmittedCallTxData, Option<PrivateStateId>)>
Returns the most-recent unsubmitted call’s data + optional
private-state id. Port of TS
getLastUnsubmittedCallTxDataToTransact().
Sourcepub fn merge_unsubmitted_call_tx_data(
&self,
circuit_id: CircuitId,
call_data: UnsubmittedCallTxData,
private_state_id: Option<PrivateStateId>,
)
pub fn merge_unsubmitted_call_tx_data( &self, circuit_id: CircuitId, call_data: UnsubmittedCallTxData, private_state_id: Option<PrivateStateId>, )
Merge a circuit-call’s unsubmitted-tx data into the running
scope. Port of TS [MergeUnsubmittedCallTxData].
- Records
(call_data, private_state_id)as the latest unsubmitted call. - Appends the call’s unproven tx bytes onto the accumulator queue (deferred merging — see module-level docs).
- Appends
circuit_idonto the circuit-id list. - If states are cached, advances them by the call: the
contract’s data becomes the call’s next contract state and
the private-state slot its
next_private_state, so the next call in the scope runs against them. The zswap chain state, the ledger parameters and the pinned block stay as read.
Sourcepub fn defer_submission(&self, deferred: DeferredSubmission)
pub fn defer_submission(&self, deferred: DeferredSubmission)
Record what submitting the scope needs from the call just merged: its fee-balancing inputs and private-state serializer.
Sourcepub async fn submit(&self) -> Result<FinalizedCallTxData>
pub async fn submit(&self) -> Result<FinalizedCallTxData>
Submit the accumulated calls as a single transaction. Port of
TS [Submit]().
§Errors
- Returns a clear
Providererror when no calls have been merged into the scope (the TS variant throwsError('No calls were submitted.')). - Propagates any error from
crate::submit_tx::submit_tx. - On non-
SucceedEntirely, raisesContractsError::CallTxFailedcarrying every merged circuit id (matches TS’snew CallTxFailedError(..., submitTxOptions.circuitId!)).
Sourcepub fn accumulated_circuit_ids(&self) -> Vec<CircuitId>
pub fn accumulated_circuit_ids(&self) -> Vec<CircuitId>
Returns the accumulated Vec<FinalizedTxData> slot — empty
until submit() runs. Used by tests; equivalent to the TS
submitTxOptions accumulator visibility.
Sourcepub fn merged_call_count(&self) -> usize
pub fn merged_call_count(&self) -> usize
Returns the number of merged calls — a proxy for whether the scope has been used.
Auto Trait Implementations§
impl !Freeze for TransactionContextImpl
impl !RefUnwindSafe for TransactionContextImpl
impl !UnwindSafe for TransactionContextImpl
impl Forget for TransactionContextImpl
impl Move for TransactionContextImpl
impl Send for TransactionContextImplwhere
Arc<ErasedProviders>: Send,
RawVecInner: Send,
RawTable<(CoinPublicKey, EncPublicKey)>: Send,
Mutex<Option<CachedEntry>>: Send,
Mutex<Option<(UnsubmittedCallTxData, Option<PrivateStateId>)>>: Send,
Mutex<DeferredSubmission>: Send,
Mutex<Vec<UnprovenTx>>: Send,
Mutex<Vec<CircuitId>>: Send,
impl Sync for TransactionContextImplwhere
Arc<ErasedProviders>: Sync,
RawVecInner: Sync,
RawTable<(CoinPublicKey, EncPublicKey)>: Sync,
Mutex<Option<CachedEntry>>: Sync,
Mutex<Option<(UnsubmittedCallTxData, Option<PrivateStateId>)>>: Sync,
Mutex<DeferredSubmission>: Sync,
Mutex<Vec<UnprovenTx>>: Sync,
Mutex<Vec<CircuitId>>: Sync,
impl Unpin for TransactionContextImplwhere
Arc<ErasedProviders>: Unpin,
*const u8 is !null: Unpin,
Align4<u32>: Unpin,
Align1<u8>: Unpin,
Arc<StateValue>: Unpin,
GenericArrayImplEven<u8, GenericArrayImplEven<u8, GenericArrayImplEven<u8, GenericArrayImplEven<u8, GenericArrayImplEven<u8, GenericArrayImplOdd<u8, [u8; 0]>>>>>>: Unpin,
Arc<Vec<u8>>: Unpin,
Arc<Vec<ArenaKey>>: Unpin,
Arc<ReentrantMutex<RawMutex, RawThreadId, RefCell<HashMap<ArenaHash, Node>>>>: Unpin,
Arc<ReentrantMutex<RawMutex, RawThreadId, RefCell<HashMap<(ArenaHash, TypeId), Weak<dyn Any + Sync + Send>>>>>: Unpin,
Arc<ReentrantMutex<RawMutex, RawThreadId, RefCell<StorageBackend<InMemoryDB>>>>: Unpin,
Arc<MerklePatriciaTrie<u64>>: Unpin,
Arc<MerklePatriciaTrie<ChildRef<InMemoryDB>>>: Unpin,
Arc<MerklePatriciaTrie<(Sp<EntryPointBuf>, Sp<ContractOperation>)>>: Unpin,
AffinePoint: Unpin,
Arc<MerklePatriciaTrie<(Sp<TokenType>, Sp<u128>)>>: Unpin,
*const LeafNode<String, RuntimeValue> is !null: Unpin,
Box<(String, RuntimeValue)>: Unpin,
(): Unpin,
Arc<AlignedValueChecked>: Unpin,
Arc<MerklePatriciaTrie<(Sp<AlignedValueChecked>, Sp<StateValue<InMemoryDB, AlignedValueChecked>>)>>: Unpin,
Arc<MerklePatriciaTrie<StateValue<InMemoryDB, AlignedValueChecked>>>: Unpin,
Arc<MerkleTreeNode<(), InMemoryDB>>: Unpin,
Arc<MerklePatriciaTrie<Key>>: Unpin,
Arc<MerklePatriciaTrie<(Sp<Nullifier>, Sp<()>)>>: Unpin,
Arc<MerklePatriciaTrie<(Sp<Commitment>, Sp<()>)>>: Unpin,
Arc<MerklePatriciaTrie<(Sp<ClaimedContractCallsValue>, Sp<()>)>>: Unpin,
Arc<MerklePatriciaTrie<(Sp<HashOutput>, Sp<u64>)>>: Unpin,
Arc<MerklePatriciaTrie<(Sp<ClaimedUnshieldedSpendsKey>, Sp<u128>)>>: Unpin,
Arc<MerklePatriciaTrie<Op<ResultModeVerify>>>: Unpin,
Arc<TranscriptVersion>: Unpin,
Arc<AlignedValue>: Unpin,
Arc<MerklePatriciaTrie<(Sp<AlignedValue>, Sp<StateValue>)>>: Unpin,
Arc<MerklePatriciaTrie<StateValue>>: Unpin,
Arc<MerklePatriciaTrie<(Sp<u16>, Sp<Intent<Signature, ProofPreimageMarker, EmbeddedFr, InMemoryDB>>)>>: Unpin,
Arc<Offer<ProofPreimage, InMemoryDB>>: Unpin,
Arc<MerklePatriciaTrie<(Sp<u16>, Sp<Offer<ProofPreimage, InMemoryDB>>)>>: Unpin,
Signature: Unpin,
Arc<MerkleTreeNode<DustGenerationInfo, InMemoryDB>>: Unpin,
Arc<MerklePatriciaTrie<(Sp<InitialNonce>, Sp<u64>)>>: Unpin,
Arc<MerklePatriciaTrie<(Sp<DustNullifier>, Sp<DustWalletUtxoState>)>>: Unpin,
Box<dyn Fn(&RuntimeValue) -> Result<Vec<u8>, ContractRuntimeError> + Sync + Send>: Unpin,
impl UnsafeUnpin for TransactionContextImplwhere
*const ArcInner<ErasedProviders> is !null: UnsafeUnpin,
PhantomData<ArcInner<ErasedProviders>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<(CoinPublicKey, EncPublicKey)>: UnsafeUnpin,
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
*const ArcInner<StateValue> is !null: UnsafeUnpin,
PhantomData<ArcInner<StateValue>>: UnsafeUnpin,
PhantomData<Arc<StateValue>>: UnsafeUnpin,
GenericArrayImplEven<u8, GenericArrayImplEven<u8, GenericArrayImplEven<u8, GenericArrayImplEven<u8, GenericArrayImplEven<u8, GenericArrayImplOdd<u8, [u8; 0]>>>>>>: UnsafeUnpin,
*const ArcInner<Vec<u8>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Vec<u8>>>: UnsafeUnpin,
*const ArcInner<Vec<ArenaKey>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Vec<ArenaKey>>>: UnsafeUnpin,
*const ArcInner<ReentrantMutex<RawMutex, RawThreadId, RefCell<HashMap<ArenaHash, Node>>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<ReentrantMutex<RawMutex, RawThreadId, RefCell<HashMap<ArenaHash, Node>>>>>: UnsafeUnpin,
*const ArcInner<ReentrantMutex<RawMutex, RawThreadId, RefCell<HashMap<(ArenaHash, TypeId), Weak<dyn Any + Sync + Send>>>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<ReentrantMutex<RawMutex, RawThreadId, RefCell<HashMap<(ArenaHash, TypeId), Weak<dyn Any + Sync + Send>>>>>>: UnsafeUnpin,
*const ArcInner<ReentrantMutex<RawMutex, RawThreadId, RefCell<StorageBackend<InMemoryDB>>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<ReentrantMutex<RawMutex, RawThreadId, RefCell<StorageBackend<InMemoryDB>>>>>: UnsafeUnpin,
*const ArcInner<MerklePatriciaTrie<u64>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerklePatriciaTrie<u64>>>: UnsafeUnpin,
PhantomData<Arc<MerklePatriciaTrie<u64>>>: UnsafeUnpin,
PhantomData<ArenaHash>: UnsafeUnpin,
*const ArcInner<MerklePatriciaTrie<ChildRef<InMemoryDB>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerklePatriciaTrie<ChildRef<InMemoryDB>>>>: UnsafeUnpin,
PhantomData<Arc<MerklePatriciaTrie<ChildRef<InMemoryDB>>>>: UnsafeUnpin,
PhantomData<ArenaKey>: UnsafeUnpin,
*const ArcInner<MerklePatriciaTrie<(Sp<EntryPointBuf>, Sp<ContractOperation>)>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerklePatriciaTrie<(Sp<EntryPointBuf>, Sp<ContractOperation>)>>>: UnsafeUnpin,
PhantomData<Arc<MerklePatriciaTrie<(Sp<EntryPointBuf>, Sp<ContractOperation>)>>>: UnsafeUnpin,
PhantomData<ContractMaintenanceVerifyingKey>: UnsafeUnpin,
*const ArcInner<MerklePatriciaTrie<(Sp<TokenType>, Sp<u128>)>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerklePatriciaTrie<(Sp<TokenType>, Sp<u128>)>>>: UnsafeUnpin,
PhantomData<Arc<MerklePatriciaTrie<(Sp<TokenType>, Sp<u128>)>>>: UnsafeUnpin,
PhantomData<RuntimeValue>: UnsafeUnpin,
*const LeafNode<String, RuntimeValue> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, RuntimeValue)>>: UnsafeUnpin,
PhantomData<Op<ResultModeGather>>: UnsafeUnpin,
*const ArcInner<MerklePatriciaTrie<(Sp<Nullifier>, Sp<()>)>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerklePatriciaTrie<(Sp<Nullifier>, Sp<()>)>>>: UnsafeUnpin,
PhantomData<Arc<MerklePatriciaTrie<(Sp<Nullifier>, Sp<()>)>>>: UnsafeUnpin,
*const ArcInner<MerklePatriciaTrie<(Sp<Commitment>, Sp<()>)>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerklePatriciaTrie<(Sp<Commitment>, Sp<()>)>>>: UnsafeUnpin,
PhantomData<Arc<MerklePatriciaTrie<(Sp<Commitment>, Sp<()>)>>>: UnsafeUnpin,
*const ArcInner<MerklePatriciaTrie<(Sp<ClaimedContractCallsValue>, Sp<()>)>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerklePatriciaTrie<(Sp<ClaimedContractCallsValue>, Sp<()>)>>>: UnsafeUnpin,
PhantomData<Arc<MerklePatriciaTrie<(Sp<ClaimedContractCallsValue>, Sp<()>)>>>: UnsafeUnpin,
*const ArcInner<MerklePatriciaTrie<(Sp<HashOutput>, Sp<u64>)>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerklePatriciaTrie<(Sp<HashOutput>, Sp<u64>)>>>: UnsafeUnpin,
PhantomData<Arc<MerklePatriciaTrie<(Sp<HashOutput>, Sp<u64>)>>>: UnsafeUnpin,
*const ArcInner<MerklePatriciaTrie<(Sp<ClaimedUnshieldedSpendsKey>, Sp<u128>)>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerklePatriciaTrie<(Sp<ClaimedUnshieldedSpendsKey>, Sp<u128>)>>>: UnsafeUnpin,
PhantomData<Arc<MerklePatriciaTrie<(Sp<ClaimedUnshieldedSpendsKey>, Sp<u128>)>>>: UnsafeUnpin,
*const ArcInner<MerklePatriciaTrie<Op<ResultModeVerify>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerklePatriciaTrie<Op<ResultModeVerify>>>>: UnsafeUnpin,
PhantomData<Arc<MerklePatriciaTrie<Op<ResultModeVerify>>>>: UnsafeUnpin,
*const ArcInner<TranscriptVersion> is !null: UnsafeUnpin,
PhantomData<ArcInner<TranscriptVersion>>: UnsafeUnpin,
PhantomData<Arc<TranscriptVersion>>: UnsafeUnpin,
PhantomData<CallEvent>: UnsafeUnpin,
PhantomData<ValueAtom>: UnsafeUnpin,
PhantomData<AlignmentSegment>: UnsafeUnpin,
PhantomData<AlignedValue>: UnsafeUnpin,
PhantomData<QualifiedInfo>: UnsafeUnpin,
PhantomData<CompactZswapOutput>: UnsafeUnpin,
PhantomData<CalleeCall>: UnsafeUnpin,
*const ArcInner<MerklePatriciaTrie<(Sp<u16>, Sp<Intent<Signature, ProofPreimageMarker, EmbeddedFr, InMemoryDB>>)>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerklePatriciaTrie<(Sp<u16>, Sp<Intent<Signature, ProofPreimageMarker, EmbeddedFr, InMemoryDB>>)>>>: UnsafeUnpin,
PhantomData<Arc<MerklePatriciaTrie<(Sp<u16>, Sp<Intent<Signature, ProofPreimageMarker, EmbeddedFr, InMemoryDB>>)>>>: UnsafeUnpin,
*const ArcInner<Offer<ProofPreimage, InMemoryDB>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Offer<ProofPreimage, InMemoryDB>>>: UnsafeUnpin,
PhantomData<Arc<Offer<ProofPreimage, InMemoryDB>>>: UnsafeUnpin,
*const ArcInner<MerklePatriciaTrie<(Sp<u16>, Sp<Offer<ProofPreimage, InMemoryDB>>)>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerklePatriciaTrie<(Sp<u16>, Sp<Offer<ProofPreimage, InMemoryDB>>)>>>: UnsafeUnpin,
PhantomData<Arc<MerklePatriciaTrie<(Sp<u16>, Sp<Offer<ProofPreimage, InMemoryDB>>)>>>: UnsafeUnpin,
AffinePoint: UnsafeUnpin,
Signature: UnsafeUnpin,
PhantomData<Vec<u8>>: UnsafeUnpin,
PhantomData<Info>: UnsafeUnpin,
*const ArcInner<MerkleTreeNode<DustGenerationInfo, InMemoryDB>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerkleTreeNode<DustGenerationInfo, InMemoryDB>>>: UnsafeUnpin,
PhantomData<Arc<MerkleTreeNode<DustGenerationInfo, InMemoryDB>>>: UnsafeUnpin,
*const ArcInner<MerkleTreeNode<(), InMemoryDB>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerkleTreeNode<(), InMemoryDB>>>: UnsafeUnpin,
PhantomData<Arc<MerkleTreeNode<(), InMemoryDB>>>: UnsafeUnpin,
*const ArcInner<MerklePatriciaTrie<(Sp<InitialNonce>, Sp<u64>)>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerklePatriciaTrie<(Sp<InitialNonce>, Sp<u64>)>>>: UnsafeUnpin,
PhantomData<Arc<MerklePatriciaTrie<(Sp<InitialNonce>, Sp<u64>)>>>: UnsafeUnpin,
*const ArcInner<MerklePatriciaTrie<(Sp<DustNullifier>, Sp<DustWalletUtxoState>)>> is !null: UnsafeUnpin,
PhantomData<ArcInner<MerklePatriciaTrie<(Sp<DustNullifier>, Sp<DustWalletUtxoState>)>>>: UnsafeUnpin,
PhantomData<Arc<MerklePatriciaTrie<(Sp<DustNullifier>, Sp<DustWalletUtxoState>)>>>: UnsafeUnpin,
PhantomData<PendingDustSpend>: UnsafeUnpin,
*const dyn Fn(&RuntimeValue) -> Result<Vec<u8>, ContractRuntimeError> + Sync + Send is !null: UnsafeUnpin,
PhantomData<dyn Fn(&RuntimeValue) -> Result<Vec<u8>, ContractRuntimeError> + Sync + Send>: UnsafeUnpin,
PhantomData<UnprovenTx>: UnsafeUnpin,
PhantomData<CircuitId>: UnsafeUnpin,
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
Source§impl<T> Envelope<PhantomData<T>> for T
impl<T> Envelope<PhantomData<T>> for T
Source§fn into_envelope(&self) -> PhantomData<T>
fn into_envelope(&self) -> PhantomData<T>
Source§fn envelope_data(&self) -> Vec<u8> ⓘwhere
T: Serializable + Tagged,
fn envelope_data(&self) -> Vec<u8> ⓘwhere
T: Serializable + Tagged,
Source§fn envelope_write(&self, writer: impl Write) -> Result<(), Error>where
T: Serializable + Tagged,
fn envelope_write(&self, writer: impl Write) -> Result<(), Error>where
T: Serializable + Tagged,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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 moreimpl<T> JsonSchemaMaybe for T
impl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSend for T
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§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();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§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();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§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();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§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();Source§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.
Source§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);Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§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 moreSource§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 moreSource§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
Source§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
Source§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.Source§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.Source§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.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§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> SyncDeps for T
impl<T> SyncDeps for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.