Trait snarkvm_circuit::environment::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 Mode
impl Display for AsciiChar
impl Display for Infallible
impl Display for IpAddr
impl Display for SocketAddr
impl Display for VarError
impl Display for std::io::error::ErrorKind
impl Display for std::sync::mpsc::RecvTimeoutError
impl Display for std::sync::mpsc::TryRecvError
impl Display for bincode::error::ErrorKind
impl Display for FromHexError
impl Display for serde_json::value::Value
impl Display for BernoulliError
impl Display for WeightedError
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 AleoV0
impl Display for snarkvm_circuit::Error
impl Display for Circuit
impl Display for Arguments<'_>
impl Display for snarkvm_circuit::environment::prelude::fmt::Error
impl Display for alloc::collections::TryReserveError
impl Display for FromVecWithNulError
impl Display for IntoStringError
impl Display for NulError
impl Display for FromUtf8Error
impl Display for FromUtf16Error
impl Display for String
impl Display for LayoutError
impl Display for core::alloc::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 core::num::dec2flt::ParseFloatError
impl Display for 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::io::error::Error
impl Display for Display<'_>
impl Display for StripPrefixError
impl Display for ExitStatus
impl Display for ExitStatusError
impl Display for std::sync::mpsc::RecvError
impl Display for AccessError
impl Display for SystemTimeError
impl Display for ParseError
impl Display for curl::error::Error
impl Display for FormError
impl Display for MultiError
impl Display for getrandom::error::Error
impl Display for indexmap::TryReserveError
impl Display for BigInt
impl Display for BigUint
impl Display for ParseBigIntError
impl Display for num_traits::ParseFloatError
impl Display for serde::de::value::Error
impl Display for serde_json::error::Error
impl Display for Number
impl Display for ReadError
impl Display for rand_core::error::Error
impl Display for AllocError
impl Display for BigInteger256
impl Display for BigInteger384
impl Display for CollectionAllocErr
impl Display for ColoredString
impl Display for ConstraintFieldError
impl Display for Errno
impl Display for Error
impl Display for Error
impl Display for Error
impl Display for Error
impl Display for Error
impl Display for FieldError
impl Display for GroupError
impl Display for InvalidBufferSize
impl Display for InvalidLength
impl Display for InvalidOutputSize
impl Display for LiteralType
impl Display for MacError
impl Display for PCError
impl Display for ParameterError
impl Display for RecvError
impl Display for RecvTimeoutError
impl Display for SNARKError
impl Display for SelectTimeoutError
impl Display for SerializationError
impl Display for SynthesisError
impl Display for ThreadPoolBuildError
impl Display for TryRecvError
impl Display for TrySelectError
impl<'a> Display for Unexpected<'a>
impl<'a> Display for EscapeAscii<'a>
impl<'a> Display for core::str::iter::EscapeDebug<'a>
impl<'a> Display for core::str::iter::EscapeDefault<'a>
impl<'a> Display for core::str::iter::EscapeUnicode<'a>
impl<'a> Display for dyn Expected + 'a
impl<'a, I> Display for Format<'a, I>where I: Iterator, <I as Iterator>::Item: Display,
impl<'a, I, F> Display for FormatWith<'a, I, F>where I: Iterator, F: FnMut(<I as Iterator>::Item, &mut dyn FnMut(&dyn Display) -> Result<(), Error>) -> Result<(), Error>,
impl<'a, K, V> Display for std::collections::hash::map::OccupiedError<'a, K, V>where K: Debug, V: Debug,
impl<'a, K, V, A> Display for alloc::collections::btree::map::entry::OccupiedError<'a, K, V, A>where K: Debug + Ord, V: Debug, A: Allocator + Clone,
impl<'a, K, V, S, A> Display for OccupiedError<'a, K, V, S, A>where K: Debug, V: Debug, A: Allocator + Clone,
impl<'a, R, G, T> Display for MappedReentrantMutexGuard<'a, R, G, T>where R: RawMutex + 'a, G: GetThreadId + 'a, T: Display + 'a + ?Sized,
impl<'a, R, G, T> Display for ReentrantMutexGuard<'a, R, G, T>where R: RawMutex + 'a, G: GetThreadId + 'a, T: Display + 'a + ?Sized,
impl<'a, R, T> Display for MappedMutexGuard<'a, R, T>where R: RawMutex + 'a, T: Display + 'a + ?Sized,
impl<'a, R, T> Display for MappedRwLockReadGuard<'a, R, T>where R: RawRwLock + 'a, T: Display + 'a + ?Sized,
impl<'a, R, T> Display for MappedRwLockWriteGuard<'a, R, T>where R: RawRwLock + 'a, T: Display + 'a + ?Sized,
impl<'a, R, T> Display for MutexGuard<'a, R, T>where R: RawMutex + 'a, T: Display + 'a + ?Sized,
impl<'a, R, T> Display for RwLockReadGuard<'a, R, T>where R: RawRwLock + 'a, T: Display + 'a + ?Sized,
impl<'a, R, T> Display for RwLockUpgradableReadGuard<'a, R, T>where R: RawRwLockUpgrade + 'a, T: Display + 'a + ?Sized,
impl<'a, R, T> Display for RwLockWriteGuard<'a, R, T>where R: RawRwLock + 'a, T: Display + 'a + ?Sized,
impl<A> Display for snarkvm_circuit::Literal<A>where A: Aleo,
impl<A> Display for snarkvm_circuit::Identifier<A>where A: Aleo,
impl<B> Display for Cow<'_, B>where B: Display + ToOwned + ?Sized, <B as ToOwned>::Owned: Display,
impl<E> Display for snarkvm_circuit::Address<E>where E: Environment,
impl<E> Display for snarkvm_circuit::Boolean<E>where E: Environment,
impl<E> Display for snarkvm_circuit::Field<E>where E: Environment,
impl<E> Display for snarkvm_circuit::Group<E>where E: Environment,
impl<E> Display for snarkvm_circuit::Scalar<E>where E: Environment,
impl<E> Display for snarkvm_circuit::StringType<E>where E: Environment,
impl<E> Display for Report<E>where E: Error,
impl<E> Display for Address<E>where E: Environment,
impl<E> Display for Boolean<E>where E: Environment,
impl<E> Display for CircuitVerifyingKey<E>where E: PairingEngine,
impl<E> Display for Err<E>where E: Debug,
impl<E> Display for Field<E>where E: Environment,
impl<E> Display for Group<E>where E: Environment,
impl<E> Display for Scalar<E>where E: Environment,
impl<E> Display for StringType<E>where E: Environment,
impl<E, I> Display for Integer<E, I>where E: Environment, I: IntegerType,
impl<E, I> Display for Integer<E, I>where E: Environment, I: IntegerType,
impl<F> Display for Variable<F>where F: PrimeField,
impl<F> Display for LinearCombination<F>where F: PrimeField,
impl<F> Display for R1CS<F>where F: PrimeField,
impl<F, const PREFIX: u16> Display for AleoID<F, PREFIX>where F: FieldTrait,
impl<I> Display for ExactlyOneError<I>where I: Iterator,
impl<I> Display for Error<I>where I: Display,
The Display implementation allows the std::error::Error implementation