[−][src]Struct validatron::error::ErrorBuilder
A convenience type for building a structured error type
Implementations
impl ErrorBuilder
[src]
pub fn contains_errors(&self) -> bool
[src]
does the builder contain any error messages, used to short circuit various functions if no error has been detected.
pub fn build(&mut self) -> Result<()>
[src]
Consume the builder and produce a Result
let e = Error::build() .at_named("a", "flat out broken") .build(); assert!(e.is_err());
pub fn at_location(
&mut self,
location: Location,
message: impl Into<Cow<'static, str>>
) -> &mut Self
[src]
&mut self,
location: Location,
message: impl Into<Cow<'static, str>>
) -> &mut Self
extend the existing builder with an error at the specified location
pub fn at_named(
&mut self,
name: impl Into<Cow<'static, str>>,
message: impl Into<Cow<'static, str>>
) -> &mut Self
[src]
&mut self,
name: impl Into<Cow<'static, str>>,
message: impl Into<Cow<'static, str>>
) -> &mut Self
extend an existing builder with an error at a named location
let e = Error::build() .at_named("field_1", "should be empty") .build();
pub fn at_index(
&mut self,
index: usize,
message: impl Into<Cow<'static, str>>
) -> &mut Self
[src]
&mut self,
index: usize,
message: impl Into<Cow<'static, str>>
) -> &mut Self
extend an existing builder with an error at an indexed location
let e = Error::build() .at_index(1, "value should be even") .build();
pub fn try_at_location(
&mut self,
location: Location,
result: Result<()>
) -> &mut Self
[src]
&mut self,
location: Location,
result: Result<()>
) -> &mut Self
extend the existing builder at the specified location if the result is an error
let e = Error::build() .try_at_location(Location::Index(1), Ok(())) .build(); assert!(e.is_ok());
pub fn try_at_named(
&mut self,
name: impl Into<Cow<'static, str>>,
result: Result<()>
) -> &mut Self
[src]
&mut self,
name: impl Into<Cow<'static, str>>,
result: Result<()>
) -> &mut Self
extend an existing builder with an error at a named location if the result is an error
let e = Error::build() .try_at_named("field", Ok(())) .build(); assert!(e.is_ok());
pub fn try_at_index(&mut self, index: usize, result: Result<()>) -> &mut Self
[src]
extend an existing builder with an error at an indexed location if the result is an error
let e = Error::build() .try_at_index(42, Ok(())) .build(); assert!(e.is_ok());
Auto Trait Implementations
impl RefUnwindSafe for ErrorBuilder
[src]
impl Send for ErrorBuilder
[src]
impl Sync for ErrorBuilder
[src]
impl Unpin for ErrorBuilder
[src]
impl UnwindSafe for ErrorBuilder
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,