#[repr(u32)]pub enum FinalityThreshold {
Fast = 1_000,
Standard = 2_000,
}Expand description
Finality threshold for CCTP v2 messages
Determines the level of finality required before Circle’s attestation service will sign a message. Lower thresholds enable faster transfers but may have slightly higher fees.
§Examples
use cctp_rs::FinalityThreshold;
let fast = FinalityThreshold::Fast;
assert_eq!(fast.as_u32(), 1000);
assert_eq!(fast.name(), "Fast Transfer");
let standard = FinalityThreshold::Standard;
assert_eq!(standard.as_u32(), 2000);Variants§
Fast = 1_000
Fast Transfer - Attestation at confirmed block level (threshold: 1000)
- Settlement time: Under 30 seconds
- Fee: 0-14 basis points (chain-dependent)
- Use case: Time-sensitive operations, arbitrage, real-time DeFi
Standard = 2_000
Standard Transfer - Attestation at finalized block level (threshold: 2000)
- Settlement time: 13-19 minutes (same as v1)
- Fee: 0 basis points
- Use case: Non-urgent transfers, maximum security
Implementations§
Source§impl FinalityThreshold
impl FinalityThreshold
Sourcepub const fn as_u32(self) -> u32
pub const fn as_u32(self) -> u32
Returns the numeric threshold value
§Example
use cctp_rs::FinalityThreshold;
assert_eq!(FinalityThreshold::Fast.as_u32(), 1000);
assert_eq!(FinalityThreshold::Standard.as_u32(), 2000);Sourcepub const fn from_u32(value: u32) -> Option<Self>
pub const fn from_u32(value: u32) -> Option<Self>
Attempts to create a FinalityThreshold from a u32 value
§Example
use cctp_rs::FinalityThreshold;
assert_eq!(
FinalityThreshold::from_u32(1000),
Some(FinalityThreshold::Fast)
);
assert_eq!(
FinalityThreshold::from_u32(2000),
Some(FinalityThreshold::Standard)
);
assert_eq!(FinalityThreshold::from_u32(1500), None);Sourcepub const fn name(self) -> &'static str
pub const fn name(self) -> &'static str
Returns a descriptive name for this threshold
§Example
use cctp_rs::FinalityThreshold;
assert_eq!(FinalityThreshold::Fast.name(), "Fast Transfer");
assert_eq!(FinalityThreshold::Standard.name(), "Standard Transfer");Sourcepub const fn is_fast(self) -> bool
pub const fn is_fast(self) -> bool
Returns true if this is a Fast Transfer threshold
§Example
use cctp_rs::FinalityThreshold;
assert!(FinalityThreshold::Fast.is_fast());
assert!(!FinalityThreshold::Standard.is_fast());Sourcepub const fn is_standard(self) -> bool
pub const fn is_standard(self) -> bool
Returns true if this is a Standard Transfer threshold
§Example
use cctp_rs::FinalityThreshold;
assert!(FinalityThreshold::Standard.is_standard());
assert!(!FinalityThreshold::Fast.is_standard());Trait Implementations§
Source§impl Clone for FinalityThreshold
impl Clone for FinalityThreshold
Source§fn clone(&self) -> FinalityThreshold
fn clone(&self) -> FinalityThreshold
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FinalityThreshold
impl Debug for FinalityThreshold
Source§impl Default for FinalityThreshold
impl Default for FinalityThreshold
Source§impl Display for FinalityThreshold
impl Display for FinalityThreshold
Source§impl From<FinalityThreshold> for u32
impl From<FinalityThreshold> for u32
Source§fn from(threshold: FinalityThreshold) -> Self
fn from(threshold: FinalityThreshold) -> Self
Converts to this type from the input type.
Source§impl Hash for FinalityThreshold
impl Hash for FinalityThreshold
Source§impl PartialEq for FinalityThreshold
impl PartialEq for FinalityThreshold
Source§impl TryFrom<u32> for FinalityThreshold
impl TryFrom<u32> for FinalityThreshold
impl Copy for FinalityThreshold
impl Eq for FinalityThreshold
impl StructuralPartialEq for FinalityThreshold
Auto Trait Implementations§
impl Freeze for FinalityThreshold
impl RefUnwindSafe for FinalityThreshold
impl Send for FinalityThreshold
impl Sync for FinalityThreshold
impl Unpin for FinalityThreshold
impl UnwindSafe for FinalityThreshold
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
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 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>
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.