mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 08:14:20 +00:00
add attributes to Validated
methods (#2555)
This commit is contained in:
parent
45ff753e77
commit
2aafcf9a3d
@ -389,6 +389,7 @@ pub enum Validated<E> {
|
|||||||
impl<E> Validated<E> {
|
impl<E> Validated<E> {
|
||||||
/// Maps the inner `Error` value using the provided function, or does nothing if the value is
|
/// Maps the inner `Error` value using the provided function, or does nothing if the value is
|
||||||
/// `ValidationError`.
|
/// `ValidationError`.
|
||||||
|
#[inline]
|
||||||
pub fn map<F>(self, f: impl FnOnce(E) -> F) -> Validated<F> {
|
pub fn map<F>(self, f: impl FnOnce(E) -> F) -> Validated<F> {
|
||||||
match self {
|
match self {
|
||||||
Self::Error(err) => Validated::Error(f(err)),
|
Self::Error(err) => Validated::Error(f(err)),
|
||||||
@ -396,6 +397,7 @@ impl<E> Validated<E> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn map_validation(self, f: impl FnOnce(Box<ValidationError>) -> Box<ValidationError>) -> Self {
|
fn map_validation(self, f: impl FnOnce(Box<ValidationError>) -> Box<ValidationError>) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Error(err) => Self::Error(err),
|
Self::Error(err) => Self::Error(err),
|
||||||
@ -404,6 +406,8 @@ impl<E> Validated<E> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the inner `Error` value, or panics if it contains `ValidationError`.
|
/// Returns the inner `Error` value, or panics if it contains `ValidationError`.
|
||||||
|
#[inline(always)]
|
||||||
|
#[track_caller]
|
||||||
pub fn unwrap(self) -> E {
|
pub fn unwrap(self) -> E {
|
||||||
match self {
|
match self {
|
||||||
Self::Error(err) => err,
|
Self::Error(err) => err,
|
||||||
|
Loading…
Reference in New Issue
Block a user