Trait floresta_common::prelude::fmt::Display
1.0.0 · source · pub trait Display {
// Required method
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>;
}
Expand description
Format trait for an empty format, {}
.
Implementing this trait for a type will automatically implement the
ToString
trait for the type, allowing the usage
of the .to_string()
method. Prefer implementing
the Display
trait for a type, rather than ToString
.
Display
is similar to Debug
, but Display
is for user-facing
output, and so cannot be derived.
For more information on formatters, see the module-level documentation.
Examples
Implementing Display
on a type:
use std::fmt;
struct Point {
x: i32,
y: i32,
}
impl fmt::Display for Point {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "({}, {})", self.x, self.y)
}
}
let origin = Point { x: 0, y: 0 };
assert_eq!(format!("The origin is: {origin}"), "The origin is: (0, 0)");
Required Methods§
sourcefn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats the value using the given formatter.
Examples
use std::fmt;
struct Position {
longitude: f32,
latitude: f32,
}
impl fmt::Display for Position {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "({}, {})", self.longitude, self.latitude)
}
}
assert_eq!("(1.987, 2.983)",
format!("{}", Position { longitude: 1.987, latitude: 2.983, }));
Implementors§
impl Display for base58ck::error::Error
impl Display for bech32::DecodeError
impl Display for bech32::EncodeError
impl Display for EncodeIoError
impl Display for CharError
impl Display for CheckedHrpstringError
impl Display for ChecksumError
impl Display for PaddingError
impl Display for SegwitHrpstringError
impl Display for UncheckedHrpstringError
impl Display for FromCharError
impl Display for bech32::primitives::gf32::TryFromError
impl Display for bech32::primitives::hrp::Error
impl Display for WitnessLengthError
impl Display for bech32::segwit::EncodeError
impl Display for AddressType
impl Display for FromScriptError
impl Display for P2shError
impl Display for bitcoin::address::error::ParseError
impl Display for ChildNumber
impl Display for bitcoin::bip32::Error
impl Display for bitcoin::bip152::Error
impl Display for bitcoin::bip158::Error
impl Display for Bip34Error
impl Display for ValidationError
impl Display for bitcoin::blockdata::locktime::absolute::LockTime
impl Display for bitcoin::blockdata::locktime::relative::LockTime
impl Display for bitcoin::blockdata::script::Error
impl Display for bitcoin::blockdata::script::witness_program::Error
impl Display for FromStrError
impl Display for TryFromInstructionError
impl Display for WitnessVersion
Prints WitnessVersion
number (from 0 to 16) as integer, without any prefix or suffix.
impl Display for ParseOutPointError
impl Display for bitcoin::consensus::encode::Error
impl Display for FromHexError
impl Display for TxVerifyError
impl Display for bitcoin::crypto::ecdsa::Error
impl Display for bitcoin::crypto::key::FromSliceError
impl Display for FromWifError
impl Display for ParseCompressedPublicKeyError
impl Display for ParsePublicKeyError
impl Display for AnnexError
impl Display for EcdsaSighashType
impl Display for P2wpkhError
impl Display for PrevoutsIndexError
impl Display for TapSighashType
impl Display for bitcoin::crypto::sighash::TaprootError
impl Display for SigFromSliceError
impl Display for PrefixedHexError
impl Display for UnprefixedHexError
impl Display for MerkleBlockError
impl Display for Network
impl Display for ExtractTxError
impl Display for GetKeyError
impl Display for bitcoin::psbt::IndexOutOfBoundsError
impl Display for SignError
impl Display for bitcoin::psbt::error::Error
impl Display for MessageSignatureError
impl Display for HiddenNodesError
impl Display for IncompleteBuilderError
impl Display for LeafVersion
impl Display for TaprootBuilderError
impl Display for bitcoin::taproot::TaprootError
impl Display for Denomination
impl Display for ParseAmountError
impl Display for ParseDenominationError
impl Display for bitcoin_units::amount::ParseError
impl Display for bitcoinconsensus::Error
impl Display for HexToArrayError
impl Display for HexToBytesError
impl Display for miniscript::descriptor::key::ConversionError
impl Display for DescriptorPublicKey
impl Display for DescriptorSecretKey
impl Display for miniscript::Error
impl Display for ParseThresholdError
impl Display for miniscript::interpreter::error::Error
impl Display for AnalysisError
impl Display for KeyParseError
impl Display for PolicyError
impl Display for LiftError
impl Display for miniscript::psbt::Error
impl Display for InputError
impl Display for OutputUpdateError
impl Display for SighashError
impl Display for UtxoUpdateError
impl Display for secp256k1::Error
impl Display for RecvTimeoutError
impl Display for TryRecvError
impl Display for AsciiChar
impl Display for Infallible
impl Display for IpAddr
impl Display for SocketAddr
impl Display for VarError
impl Display for ErrorKind
impl Display for bool
impl Display for char
impl Display for f32
impl Display for f64
impl Display for i8
impl Display for i16
impl Display for i32
impl Display for i64
impl Display for i128
impl Display for isize
impl Display for !
impl Display for str
impl Display for u8
impl Display for u16
impl Display for u32
impl Display for u64
impl Display for u128
impl Display for usize
impl Display for IncorrectChecksumError
impl Display for base58ck::error::InvalidCharacterError
impl Display for TooShortError
impl Display for CodeLengthError
impl Display for SegwitCodeLengthError
impl Display for Fe32
impl Display for Hrp
Displays the human-readable part.
If an uppercase HRP was parsed during object construction then the returned string will be
in uppercase also. For a lowercase string see Self::to_lowercase
.
impl Display for InvalidWitnessVersionError
impl Display for bech32::segwit::DecodeError
impl Display for bitcoin::address::error::InvalidBase58PayloadLengthError
impl Display for InvalidLegacyPrefixError
impl Display for LegacyAddressTooLongError
impl Display for NetworkValidationError
impl Display for UnknownAddressTypeError
impl Display for UnknownHrpError
impl Display for Address<NetworkChecked>
impl Display for ChainCode
impl Display for DerivationPath
impl Display for Fingerprint
impl Display for bitcoin::bip32::InvalidBase58PayloadLengthError
impl Display for XKeyIdentifier
impl Display for Xpriv
impl Display for Xpub
impl Display for ShortId
impl Display for TxIndexOutOfRangeError
impl Display for FilterHash
impl Display for FilterHeader
impl Display for BlockHash
impl Display for TxMerkleNode
impl Display for WitnessCommitment
impl Display for WitnessMerkleNode
impl Display for ChainHash
impl Display for DisabledLockTimeError
impl Display for IncompatibleHeightError
impl Display for IncompatibleTimeError
impl Display for Opcode
impl Display for Script
impl Display for Builder
impl Display for ScriptBuf
impl Display for PushBytesError
impl Display for ScriptHash
impl Display for WScriptHash
impl Display for bitcoin::blockdata::script::witness_version::TryFromError
impl Display for bitcoin::blockdata::transaction::IndexOutOfBoundsError
impl Display for InputsIndexError
impl Display for OutPoint
impl Display for OutputsIndexError
impl Display for Sequence
impl Display for Txid
impl Display for Version
impl Display for Wtxid
impl Display for BitcoinconsensusError
impl Display for bitcoin::crypto::ecdsa::SerializedSignature
impl Display for bitcoin::crypto::ecdsa::Signature
impl Display for CompressedPublicKey
impl Display for InvalidAddressVersionError
impl Display for bitcoin::crypto::key::InvalidBase58PayloadLengthError
impl Display for PrivateKey
impl Display for PubkeyHash
impl Display for bitcoin::crypto::key::PublicKey
impl Display for TweakedPublicKey
impl Display for UncompressedPublicKeyError
impl Display for WPubkeyHash
impl Display for InvalidSighashTypeError
impl Display for LegacySighash
impl Display for NonStandardSighashTypeError
impl Display for PrevoutsKindError
impl Display for PrevoutsSizeError
impl Display for SegwitV0Sighash
impl Display for SighashTypeParseError
impl Display for SingleMissingOutputError
impl Display for TapSighash
impl Display for ContainsPrefixError
impl Display for MissingPrefixError
impl Display for ParseNetworkError
impl Display for UnknownChainHashError
impl Display for CommandString
impl Display for CommandStringError
impl Display for Magic
impl Display for ParseMagicError
impl Display for ServiceFlags
impl Display for UnknownMagicError
impl Display for Target
impl Display for Work
impl Display for PsbtSighashType
impl Display for Key
impl Display for bitcoin::taproot::serialized_signature::SerializedSignature
impl Display for FutureLeafVersion
impl Display for TapLeafHash
impl Display for TapNodeHash
impl Display for TapTweakHash
impl Display for bitcoin_hashes::hash160::Hash
impl Display for bitcoin_hashes::ripemd160::Hash
impl Display for bitcoin_hashes::sha1::Hash
impl Display for bitcoin_hashes::sha256::Hash
impl Display for Midstate
impl Display for bitcoin_hashes::sha256d::Hash
impl Display for bitcoin_hashes::sha384::Hash
impl Display for bitcoin_hashes::sha512::Hash
impl Display for bitcoin_hashes::sha512_256::Hash
impl Display for bitcoin_hashes::siphash24::Hash
impl Display for bitcoin_hashes::FromSliceError
impl Display for bitcoin_io::error::Error
impl Display for Amount
impl Display for bitcoin_units::amount::Display
impl Display for InputTooLargeError
impl Display for bitcoin_units::amount::InvalidCharacterError
impl Display for MissingDigitsError
impl Display for bitcoin_units::amount::OutOfRangeError
impl Display for PossiblyConfusingDenominationError
impl Display for SignedAmount
impl Display for TooPreciseError
impl Display for UnknownDenominationError
impl Display for FeeRate
Alternative will display the unit.
impl Display for bitcoin_units::locktime::absolute::ConversionError
impl Display for bitcoin_units::locktime::absolute::Height
impl Display for ParseHeightError
impl Display for ParseTimeError
impl Display for bitcoin_units::locktime::absolute::Time
impl Display for bitcoin_units::locktime::relative::Height
impl Display for bitcoin_units::locktime::relative::Time
impl Display for TimeOverflowError
impl Display for bitcoin_units::parse::ParseIntError
impl Display for Weight
Alternative will display the unit.
impl Display for block_buffer::Error
impl Display for InvalidLength
impl Display for InvalidBufferSize
impl Display for InvalidOutputSize
impl Display for InvalidCharError
impl Display for InvalidLengthError
impl Display for OddLengthStringError
impl Display for DefiniteDescriptorKey
impl Display for DescriptorKeyParseError
impl Display for miniscript::miniscript::hash256::Hash
impl Display for miniscript::miniscript::types::Error
impl Display for AbsLockTime
impl Display for AbsLockTimeError
impl Display for RelLockTime
impl Display for RelLockTimeError
impl Display for ThresholdError
impl Display for secp256k1::ecdsa::serialized_signature::SerializedSignature
impl Display for secp256k1::ecdsa::Signature
impl Display for ElligatorSwift
impl Display for InvalidParityValue
impl Display for secp256k1::key::PublicKey
impl Display for XOnlyPublicKey
impl Display for secp256k1::scalar::OutOfRangeError
impl Display for secp256k1::schnorr::Signature
impl Display for Message
impl Display for serde::de::value::Error
impl Display for String
impl Display for floresta_common::prelude::ioError
impl Display for RecvError
impl Display for TryReserveError
impl Display for FromVecWithNulError
impl Display for IntoStringError
impl Display for NulError
impl Display for FromUtf8Error
impl Display for FromUtf16Error
impl Display for LayoutError
impl Display for AllocError
impl Display for TryFromSliceError
impl Display for core::ascii::EscapeDefault
impl Display for BorrowError
impl Display for BorrowMutError
impl Display for CharTryFromError
impl Display for ParseCharError
impl Display for DecodeUtf16Error
impl Display for core::char::EscapeDebug
impl Display for core::char::EscapeDefault
impl Display for core::char::EscapeUnicode
impl Display for ToLowercase
impl Display for ToUppercase
impl Display for TryFromCharError
impl Display for FromBytesUntilNulError
impl Display for FromBytesWithNulError
impl Display for Ipv4Addr
impl Display for Ipv6Addr
Write an Ipv6Addr, conforming to the canonical style described by RFC 5952.