pub struct PrepareError { /* private fields */ }Expand description
A prepare error whose text names types: what a server answers, boxed, so the startup report
decides how each name prints. The report runs TypeName::colliding over the names of every
server’s PrepareError and every failing transport, and calls text with the result, so a
type that prints alike with a different type another server names, or with a transport, is
written with its full path.
text writes each name in names with {:#} when the set it receives holds it, and with
{} otherwise. Display on a PrepareError alone collides its own names.
use ulo::{PrepareError, TypeName};
struct User;
let user = TypeName::of::<User>();
let error = PrepareError::new([user], move |full| {
let user = if full.contains(&user) { format!("{user:#}") } else { user.to_string() };
format!("`{user}` is read and nothing supplies it")
});
assert_eq!(error.to_string(), "`User` is read and nothing supplies it");Implementations§
Source§impl PrepareError
impl PrepareError
pub fn new( names: impl IntoIterator<Item = TypeName>, text: impl Fn(&HashSet<TypeName>) -> String + Send + Sync + 'static, ) -> Self
Sourcepub fn with_permanent(self, permanent: bool) -> Self
pub fn with_permanent(self, permanent: bool) -> Self
Marks the failure as one retrying the start cannot mend, which
is_permanent reads: a server whose prepare found a
Permanent error in a component it asked, a link’s, answers one.
Sourcepub fn is_permanent(&self) -> bool
pub fn is_permanent(&self) -> bool
Whether a failure it lists is one retrying the start cannot mend.
Sourcepub fn with_entries(self, entries: Vec<PrepareEntry>) -> Self
pub fn with_entries(self, entries: Vec<PrepareEntry>) -> Self
Sets the failures entries lists, in the order found, each as data.
pub fn names(&self) -> &[TypeName]
Sourcepub fn entries(&self) -> &[PrepareEntry]
pub fn entries(&self) -> &[PrepareEntry]
The failures this error lists, one per failure the server found; empty for an error built
by new alone.
Trait Implementations§
Source§impl Debug for PrepareError
impl Debug for PrepareError
Source§impl Display for PrepareError
impl Display for PrepareError
Source§impl Error for PrepareError
impl Error for PrepareError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()