write!
				
					
				
			This commit is contained in:
		
							parent
							
								
									5081166bca
								
							
						
					
					
						commit
						5cbabbdb37
					
				| @ -13,7 +13,7 @@ struct AvlN<A> { | |||||||
| 
 | 
 | ||||||
| impl<A: Display> Display for AvlN<A> { | impl<A: Display> Display for AvlN<A> { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         f.write_fmt(format_args!("({} {} {})", self.l, self.key, self.r)) |         write!(f, "({} {} {})", self.l, self.key, self.r) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -39,7 +39,7 @@ impl<A> Clone for AvlR<A> { | |||||||
| 
 | 
 | ||||||
| impl<A: Display> Display for AvlR<A> { | impl<A: Display> Display for AvlR<A> { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         f.write_fmt(format_args!("{}", self.node)) |         write!(f, "{}", self.node) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -67,8 +67,8 @@ impl<A> Clone for AvlT<A> { | |||||||
| impl<A: Display> Display for AvlT<A> { | impl<A: Display> Display for AvlT<A> { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match &self.reference { |         match &self.reference { | ||||||
|             Some(reference) => f.write_fmt(format_args!("{}", reference)), |             Some(reference) => write!(f, "{}", reference), | ||||||
|             None => f.write_fmt(format_args!("-")), |             None => write!(f, "-"), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -43,7 +43,7 @@ where | |||||||
|     UnbalancedReference<'a, T, A>: std::fmt::Display, |     UnbalancedReference<'a, T, A>: std::fmt::Display, | ||||||
| { | { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         f.write_fmt(format_args!("({} {} {})", self.cl, self.key, self.cr)) |         write!(f, "({} {} {})", self.cl, self.key, self.cr) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -53,15 +53,15 @@ where | |||||||
| { | { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             UnbalancedTree::Leaf => f.write_fmt(format_args!(".")), |             UnbalancedTree::Leaf => write!(f, "."), | ||||||
|             UnbalancedTree::Node(reference) => f.write_fmt(format_args!("{}", reference)), |             UnbalancedTree::Node(reference) => write!(f, "{}", reference), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl<'a, A: 'a + Display> Display for UnbalancedReference<'a, instances::solo::SoloInstance, A> { | impl<'a, A: 'a + Display> Display for UnbalancedReference<'a, instances::solo::SoloInstance, A> { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         f.write_fmt(format_args!("{}", self.0())) |         write!(f, "{}", self.0()) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -70,8 +70,8 @@ impl<'a, A: 'a + Display> Display | |||||||
| { | { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self.0() { |         match self.0() { | ||||||
|             Ok(node) => f.write_fmt(format_args!("{}", node)), |             Ok(node) => write!(f, "{}", node), | ||||||
|             Err(()) => f.write_fmt(format_args!("~")), |             Err(()) => write!(f, "~"), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ use crate::rcore::*; | |||||||
| 
 | 
 | ||||||
| impl Display for Address { | impl Display for Address { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         f.write_fmt(format_args!("{}@{}", hex::encode(self.point), self.index)) |         write!(f, "{}@{}", hex::encode(self.point), self.index) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -17,10 +17,11 @@ pub enum IntParseError { | |||||||
| impl Display for IntParseError { | impl Display for IntParseError { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             Self::Eof => f.write_fmt(format_args!("encountered EOF write parsing an integer.")), |             Self::Eof => write!(f, "encountered EOF write parsing an integer."), | ||||||
|             Self::ExtraData(length) => f.write_fmt(format_args!( |             Self::ExtraData(length) => write!( | ||||||
|  |                 f, | ||||||
|                 "encountered extra data of length {length} while parsing an integer.", |                 "encountered extra data of length {length} while parsing an integer.", | ||||||
|             )), |             ), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -22,12 +22,13 @@ impl Display for BooleanParseError { | |||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             Self::OutOfBounds(value) => { |             Self::OutOfBounds(value) => { | ||||||
|                 f.write_fmt(format_args!("boolean value out of bounds: {}.", value)) |                 write!(f, "boolean value out of bounds: {}.", value) | ||||||
|             } |             } | ||||||
|             Self::Eof => f.write_fmt(format_args!("encountered EOF write parsing a boolean.")), |             Self::Eof => write!(f, "encountered EOF write parsing a boolean."), | ||||||
|             Self::ExtraData(length) => f.write_fmt(format_args!( |             Self::ExtraData(length) => write!( | ||||||
|  |                 f, | ||||||
|                 "encountered extra data of length {length} while parsing a boolean.", |                 "encountered extra data of length {length} while parsing a boolean.", | ||||||
|             )), |             ), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -41,22 +41,22 @@ impl<'a> Display for CastError<'a> { | |||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             CastError::Typeless(typeless_error) => { |             CastError::Typeless(typeless_error) => { | ||||||
|                 f.write_fmt(format_args!("typeless cast error: {}", typeless_error)) |                 write!(f, "typeless cast error: {}", typeless_error) | ||||||
|  |             } | ||||||
|  |             CastError::AddressIndexOutOfBounds { index, length } => { | ||||||
|  |                 write!(f, "cast index out of bound: {}>={}", index, length) | ||||||
|             } |             } | ||||||
|             CastError::AddressIndexOutOfBounds { index, length } => f.write_fmt(format_args!( |  | ||||||
|                 "cast index out of bound: {}>={}", |  | ||||||
|                 index, length |  | ||||||
|             )), |  | ||||||
|             CastError::AddressPointMismatch { |             CastError::AddressPointMismatch { | ||||||
|                 expected, |                 expected, | ||||||
|                 received, |                 received, | ||||||
|                 index, |                 index, | ||||||
|             } => f.write_fmt(format_args!( |             } => write!( | ||||||
|  |                 f, | ||||||
|                 "address mismatch at index {}: {}>={}", |                 "address mismatch at index {}: {}>={}", | ||||||
|                 index, |                 index, | ||||||
|                 hex::encode(expected), |                 hex::encode(expected), | ||||||
|                 hex::encode(received), |                 hex::encode(received), | ||||||
|             )), |             ), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -39,23 +39,23 @@ impl<E: Display> Display for AvlError<E> { | |||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             Self::Int(int_error) => { |             Self::Int(int_error) => { | ||||||
|                 f.write_fmt(format_args!("failed to parse AVL tree height: {int_error}")) |                 write!(f, "failed to parse AVL tree height: {int_error}") | ||||||
|  |             } | ||||||
|  |             Self::Point(point_error) => { | ||||||
|  |                 write!(f, "failed to parse AVL node reference: {point_error}") | ||||||
|             } |             } | ||||||
|             Self::Point(point_error) => f.write_fmt(format_args!( |  | ||||||
|                 "failed to parse AVL node reference: {point_error}" |  | ||||||
|             )), |  | ||||||
|             Self::Key(key_error) => { |             Self::Key(key_error) => { | ||||||
|                 f.write_fmt(format_args!("failed to parse AVL node key: {key_error}")) |                 write!(f, "failed to parse AVL node key: {key_error}") | ||||||
|             } |             } | ||||||
|             Self::NodeHeight => f.write_fmt(format_args!("invalid AVL non-leaf height: 0.")), |             Self::NodeHeight => write!(f, "invalid AVL non-leaf height: 0."), | ||||||
|             Self::LeafHeight(height) => { |             Self::LeafHeight(height) => { | ||||||
|                 f.write_fmt(format_args!("invalid AVL leaf height: {height}!=0.")) |                 write!(f, "invalid AVL leaf height: {height}!=0.") | ||||||
|  |             } | ||||||
|  |             Self::Balance(hl, hr) => write!(f, "unbalanced AVL node: {hl} {hr}."), | ||||||
|  |             Self::HeightOverflow => write!(f, "AVL tree height overflow"), | ||||||
|  |             Self::HeightMismatch { child, parent } => { | ||||||
|  |                 write!(f, "AVL child-parent height mismatch: {child:?}, {parent}") | ||||||
|             } |             } | ||||||
|             Self::Balance(hl, hr) => f.write_fmt(format_args!("unbalanced AVL node: {hl} {hr}.")), |  | ||||||
|             Self::HeightOverflow => f.write_fmt(format_args!("AVL tree height overflow")), |  | ||||||
|             Self::HeightMismatch { child, parent } => f.write_fmt(format_args!( |  | ||||||
|                 "AVL child-parent height mismatch: {child:?}, {parent}" |  | ||||||
|             )), |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -37,14 +37,12 @@ pub enum PairParseError<ErrorA: Error, ErrorB: Error> { | |||||||
| impl<ErrorA: Error, ErrorB: Error> Display for PairParseError<ErrorA, ErrorB> { | impl<ErrorA: Error, ErrorB: Error> Display for PairParseError<ErrorA, ErrorB> { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             PairParseError::A(error) => f.write_fmt(format_args!( |             PairParseError::A(error) => { | ||||||
|                 "error while parsing first element of a pair: {}", |                 write!(f, "error while parsing first element of a pair: {}", error) | ||||||
|                 error |             } | ||||||
|             )), |             PairParseError::B(error) => { | ||||||
|             PairParseError::B(error) => f.write_fmt(format_args!( |                 write!(f, "error while parsing second element of a pair: {}", error) | ||||||
|                 "error while parsing first element of a pair: {}", |             } | ||||||
|                 error |  | ||||||
|             )), |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -57,11 +57,11 @@ pub enum StackParseError<ElementParseError: Error> { | |||||||
| impl<ElementParseError: Error> Display for StackParseError<ElementParseError> { | impl<ElementParseError: Error> Display for StackParseError<ElementParseError> { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             StackParseError::Point(ppe) => { |             Self::Point(ppe) => { | ||||||
|                 f.write_fmt(format_args!("can't parse stack's next pointer: {}", ppe)) |                 write!(f, "can't parse stack's next pointer: {}", ppe) | ||||||
|             } |             } | ||||||
|             StackParseError::Element(epe) => { |             Self::Element(epe) => { | ||||||
|                 f.write_fmt(format_args!("can't parse stack's element: {}", epe)) |                 write!(f, "can't parse stack's element: {}", epe) | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -96,10 +96,11 @@ pub struct SizeError { | |||||||
| 
 | 
 | ||||||
| impl Display for SizeError { | impl Display for SizeError { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         f.write_fmt(format_args!( |         write!( | ||||||
|  |             f, | ||||||
|             "expected {} bytes, read/wrote {} instead.", |             "expected {} bytes, read/wrote {} instead.", | ||||||
|             self.expected, self.received |             self.expected, self.received | ||||||
|         )) |         ) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -115,9 +116,9 @@ pub enum CheckedParseError<P: Error> { | |||||||
| impl<P: Error> Display for CheckedParseError<P> { | impl<P: Error> Display for CheckedParseError<P> { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             CheckedParseError::Parse(parse_error) => f.write_fmt(format_args!("{}", parse_error)), |             Self::Parse(parse_error) => write!(f, "{}", parse_error), | ||||||
|             CheckedParseError::Size(size_error) => { |             Self::Size(size_error) => { | ||||||
|                 f.write_fmt(format_args!("size check failed: {}", size_error)) |                 write!(f, "size check failed: {}", size_error) | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -41,10 +41,9 @@ pub enum PointParseError { | |||||||
| impl Display for PointParseError { | impl Display for PointParseError { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             PointParseError::WrongLength(length) => f.write_fmt(format_args!( |             Self::WrongLength(length) => { | ||||||
|                 "expected {} bytes, received {}.", |                 write!(f, "expected {} bytes, received {}.", HASH_SIZE, length) | ||||||
|                 HASH_SIZE, length |             } | ||||||
|             )), |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -4,16 +4,16 @@ use super::*; | |||||||
| 
 | 
 | ||||||
| impl<A: Display> Display for WithLengthAndWidth<A> { | impl<A: Display> Display for WithLengthAndWidth<A> { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         f.write_fmt(format_args!("{}", self.value())) |         write!(f, "{}", self.value()) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl Display for RenderedAny { | impl Display for RenderedAny { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             Self::Common(common) => f.write_fmt(format_args!("{}", common)), |             Self::Common(common) => write!(f, "{}", common), | ||||||
|             Self::Wide(vec) => f.write_fmt(format_args!("( {} )", RenderVec(vec))), |             Self::Wide(vec) => write!(f, "( {} )", RenderVec(vec)), | ||||||
|             Self::Long(vec) => f.write_fmt(format_args!("( {} )", RenderVec(vec))), |             Self::Long(vec) => write!(f, "( {} )", RenderVec(vec)), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -21,10 +21,10 @@ impl Display for RenderedAny { | |||||||
| impl Display for RenderedCommon { | impl Display for RenderedCommon { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             Self::Empty => f.write_fmt(format_args!(".")), |             Self::Empty => write!(f, "."), | ||||||
|             Self::Resolution => f.write_fmt(format_args!("?")), |             Self::Resolution => write!(f, "?"), | ||||||
|             Self::Event(event) => f.write_fmt(format_args!("{}", event)), |             Self::Event(event) => write!(f, "{}", event), | ||||||
|             Self::Action { name, rendered } => f.write_fmt(format_args!("{} @ {}", name, rendered)), |             Self::Action { name, rendered } => write!(f, "{} @ {}", name, rendered), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -36,11 +36,11 @@ impl Display for RenderVec<&Vec<WithLengthAndWidth<RenderedWide>>> { | |||||||
|         let mut delimiter = ""; |         let mut delimiter = ""; | ||||||
|         let mut tail = "~"; |         let mut tail = "~"; | ||||||
|         for rendered in self.0 { |         for rendered in self.0 { | ||||||
|             f.write_fmt(format_args!("{}{}", delimiter, rendered))?; |             write!(f, "{}{}", delimiter, rendered)?; | ||||||
|             delimiter = " > "; |             delimiter = " > "; | ||||||
|             tail = ""; |             tail = ""; | ||||||
|         } |         } | ||||||
|         f.write_fmt(format_args!("{}", tail)) |         write!(f, "{}", tail) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -49,19 +49,19 @@ impl Display for RenderVec<&Vec<WithLengthAndWidth<RenderedLong>>> { | |||||||
|         let mut delimiter = ""; |         let mut delimiter = ""; | ||||||
|         let mut tail = "~"; |         let mut tail = "~"; | ||||||
|         for rendered in self.0 { |         for rendered in self.0 { | ||||||
|             f.write_fmt(format_args!("{}{}", delimiter, rendered))?; |             write!(f, "{}{}", delimiter, rendered)?; | ||||||
|             delimiter = " | "; |             delimiter = " | "; | ||||||
|             tail = ""; |             tail = ""; | ||||||
|         } |         } | ||||||
|         f.write_fmt(format_args!("{}", tail)) |         write!(f, "{}", tail) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl Display for RenderedLong { | impl Display for RenderedLong { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             Self::Common(common) => f.write_fmt(format_args!("{}", common)), |             Self::Common(common) => write!(f, "{}", common), | ||||||
|             Self::Long(vec) => f.write_fmt(format_args!("( {} )", RenderVec(vec))), |             Self::Long(vec) => write!(f, "( {} )", RenderVec(vec)), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -69,8 +69,8 @@ impl Display for RenderedLong { | |||||||
| impl Display for RenderedWide { | impl Display for RenderedWide { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             Self::Common(common) => f.write_fmt(format_args!("{}", common)), |             Self::Common(common) => write!(f, "{}", common), | ||||||
|             Self::Wide(vec) => f.write_fmt(format_args!("( {} )", RenderVec(vec))), |             Self::Wide(vec) => write!(f, "( {} )", RenderVec(vec)), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -21,20 +21,18 @@ impl Trace { | |||||||
|     fn fmt_parallel(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt_parallel(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             Trace::Parallel(a, b) => { |             Trace::Parallel(a, b) => { | ||||||
|                 f.write_fmt(format_args!("{} | {}", ParallelBox(a), ParallelBox(b))) |                 write!(f, "{} | {}", ParallelBox(a), ParallelBox(b)) | ||||||
|             } |             } | ||||||
|             trace => f.write_fmt(format_args!("{}", trace)), |             trace => write!(f, "{}", trace), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn fmt_sequential(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt_sequential(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             Trace::Sequential { first, second } => f.write_fmt(format_args!( |             Trace::Sequential { first, second } => { | ||||||
|                 "{} > {}", |                 write!(f, "{} > {}", SequentialBox(first), SequentialBox(second)) | ||||||
|                 SequentialBox(first), |             } | ||||||
|                 SequentialBox(second) |             trace => write!(f, "{}", trace), | ||||||
|             )), |  | ||||||
|             trace => f.write_fmt(format_args!("{}", trace)), |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -58,25 +56,26 @@ impl<'a> Display for SequentialBox<'a> { | |||||||
| impl Display for Trace { | impl Display for Trace { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             Trace::Pure => f.write_fmt(format_args!(".")), |             Self::Pure => write!(f, "."), | ||||||
|             Trace::InvolvesOneResolution => f.write_fmt(format_args!("?")), |             Self::InvolvesOneResolution => write!(f, "?"), | ||||||
|             Trace::Event(event) => f.write_fmt(format_args!("{}", event)), |             Self::Event(event) => write!(f, "{}", event), | ||||||
|             Trace::Wrapped { name, trace } => f.write_fmt(format_args!("{} @ {}", name, trace)), |             Self::Wrapped { name, trace } => write!(f, "{} @ {}", name, trace), | ||||||
|             Trace::Parallel(a, b) => { |             Self::Parallel(a, b) => { | ||||||
|                 f.write_fmt(format_args!("( {} | {} )", ParallelBox(a), ParallelBox(b))) |                 write!(f, "( {} | {} )", ParallelBox(a), ParallelBox(b)) | ||||||
|             } |             } | ||||||
|             Trace::Sequential { first, second } => f.write_fmt(format_args!( |             Self::Sequential { first, second } => write!( | ||||||
|  |                 f, | ||||||
|                 "( {} > {} )", |                 "( {} > {} )", | ||||||
|                 SequentialBox(first), |                 SequentialBox(first), | ||||||
|                 SequentialBox(second) |                 SequentialBox(second) | ||||||
|             )), |             ), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl Display for TraceBox { | impl Display for TraceBox { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         f.write_fmt(format_args!("{}", self.trace)) |         write!(f, "{}", self.trace) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -84,7 +84,7 @@ pub struct TypelessError<'a>(Box<dyn 'a + Error>); | |||||||
| 
 | 
 | ||||||
| impl<'a> Display for TypelessError<'a> { | impl<'a> Display for TypelessError<'a> { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         f.write_fmt(format_args!("typeless error: {}", self.0)) |         write!(f, "typeless error: {}", self.0) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -50,16 +50,15 @@ impl<'a> From<CastError<'a>> for TestLookupError<'a> { | |||||||
| impl<'a> Display for TestLookupError<'a> { | impl<'a> Display for TestLookupError<'a> { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|         match self { |         match self { | ||||||
|             TestLookupError::Typeless(typeless_error) => { |             Self::Typeless(typeless_error) => { | ||||||
|                 f.write_fmt(format_args!("typeless lookup failure: {}", typeless_error)) |                 write!(f, "typeless lookup failure: {}", typeless_error) | ||||||
|             } |             } | ||||||
|             TestLookupError::Cast(cast_error) => { |             Self::Cast(cast_error) => { | ||||||
|                 f.write_fmt(format_args!("cast failure: {}", cast_error)) |                 write!(f, "cast failure: {}", cast_error) | ||||||
|  |             } | ||||||
|  |             Self::EmptyResolverAccess(address) => { | ||||||
|  |                 write!(f, "accessed an empty resolved at address {}.", address) | ||||||
|             } |             } | ||||||
|             TestLookupError::EmptyResolverAccess(address) => f.write_fmt(format_args!( |  | ||||||
|                 "accessed an empty resolved at address {}.", |  | ||||||
|                 address |  | ||||||
|             )), |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user