Trait floresta_common::prelude::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 bech32::DecodeError
impl Display for bech32::DecodeFromReaderError
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 bech32::primitives::gf32::Error
impl Display for bech32::primitives::hrp::Error
impl Display for WitnessLengthError
impl Display for bech32::segwit::DecodeFromReaderError
impl Display for EncodeError
impl Display for AddressType
impl Display for bitcoin::address::error::Error
impl Display for ParseError
impl Display for Denomination
impl Display for ParseAmountError
impl Display for bitcoin::base58::Error
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::Error
impl Display for bitcoin::blockdata::locktime::absolute::LockTime
impl Display for OperationError
impl Display for bitcoin::blockdata::locktime::relative::Error
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 TxVerifyError
impl Display for bitcoin::crypto::ecdsa::Error
impl Display for bitcoin::crypto::key::Error
impl Display for EcdsaSighashType
impl Display for bitcoin::crypto::sighash::Error
impl Display for TapSighashType
impl Display for SigFromSliceError
impl Display for MerkleBlockError
impl Display for Network
impl Display for ExtractTxError
impl Display for GetKeyError
impl Display for 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 TaprootError
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 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 AsciiChar
impl Display for Infallible
impl Display for IpAddr
impl Display for SocketAddr
impl Display for VarError
impl Display for ErrorKind
impl Display for RecvTimeoutError
impl Display for TryRecvError
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 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 UnknownAddressTypeError
impl Display for Address<NetworkChecked>
impl Display for Amount
impl Display for bitcoin::amount::Display
impl Display for SignedAmount
impl Display for ChainCode
impl Display for DerivationPath
impl Display for Fingerprint
impl Display for XKeyIdentifier
impl Display for Xpriv
impl Display for Xpub
impl Display for XpubIdentifier
impl Display for ShortId
impl Display for TxIndexOutOfRangeError
impl Display for ChainHash
impl Display for FeeRate
Alternative will display the unit.
impl Display for bitcoin::blockdata::locktime::absolute::ConversionError
impl Display for bitcoin::blockdata::locktime::absolute::Height
impl Display for bitcoin::blockdata::locktime::absolute::Time
impl Display for bitcoin::blockdata::locktime::relative::Height
impl Display for bitcoin::blockdata::locktime::relative::Time
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 OutPoint
impl Display for Sequence
impl Display for Weight
Alternative will display the unit.
impl Display for BitcoinconsensusError
impl Display for bitcoin::crypto::ecdsa::SerializedSignature
impl Display for bitcoin::crypto::ecdsa::Signature
impl Display for PrivateKey
impl Display for PubkeyHash
impl Display for bitcoin::crypto::key::PublicKey
impl Display for TweakedPublicKey
impl Display for WPubkeyHash
impl Display for InvalidSighashTypeError
impl Display for LegacySighash
impl Display for NonStandardSighashTypeError
impl Display for SegwitV0Sighash
impl Display for SighashTypeParseError
impl Display for TapSighash
impl Display for BlockHash
impl Display for FilterHash
impl Display for FilterHeader
impl Display for TxMerkleNode
impl Display for Txid
impl Display for WitnessCommitment
impl Display for WitnessMerkleNode
impl Display for Wtxid
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 bitcoin::parse::ParseIntError
impl Display for Target
impl Display for bitcoin::pow::TryFromError
impl Display for U256
impl Display for Work
impl Display for PsbtSighashType
impl Display for Key
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::sha512::Hash
impl Display for bitcoin_hashes::sha512_256::Hash
impl Display for bitcoin_hashes::siphash24::Hash
impl Display for FromSliceError
impl Display for block_buffer::Error
impl Display for InvalidLength
impl Display for InvalidBufferSize
impl Display for InvalidOutputSize
impl Display for DefiniteDescriptorKey
impl Display for DescriptorKeyParseError
impl Display for miniscript::miniscript::hash256::Hash
impl Display for AbsLockTime
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 OutOfRangeError
impl Display for secp256k1::schnorr::Signature
impl Display for Message
impl Display for serde::de::value::Error
impl Display for Arguments<'_>
impl Display for floresta_common::prelude::fmt::Error
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.
impl Display for AddrParseError
impl Display for SocketAddrV4
impl Display for SocketAddrV6
impl Display for ParseFloatError
impl Display for core::num::error::ParseIntError
impl Display for TryFromIntError
impl Display for NonZeroI8
impl Display for NonZeroI16
impl Display for NonZeroI32
impl Display for NonZeroI64
impl Display for NonZeroI128
impl Display for NonZeroIsize
impl Display for NonZeroU8
impl Display for NonZeroU16
impl Display for NonZeroU32
impl Display for NonZeroU64
impl Display for NonZeroU128
impl Display for NonZeroUsize
impl Display for Location<'_>
impl Display for PanicInfo<'_>
impl Display for ParseBoolError
impl Display for Utf8Error
impl Display for TryFromFloatSecsError
impl Display for Backtrace
impl Display for JoinPathsError
impl Display for WriterPanicked
impl Display for std::path::Display<'_>
impl Display for StripPrefixError
impl Display for ExitStatus
impl Display for ExitStatusError
impl Display for AccessError
impl Display for SystemTimeError
impl Display for String
impl Display for floresta_common::prelude::ioError
impl Display for RecvError
impl<'a> Display for Unexpected<'a>
impl<'a> Display for AddressEncoding<'a>
Formats bech32 as upper case if alternate formatting is chosen ({:#}
).