[−][src]Struct luminance::pipeline::Render
Output of a PipelineGate
.
This type is used as a proxy over Result<(), E>
, which it defers to. It is needed so that
you can seamlessly call the assume
method
Implementations
impl<E> Render<E>
[src]
impl Render<PipelineError>
[src]
pub fn assume(self) -> Self
[src]
Assume the error type is PipelineError
.
Most of the time, users will not provide their own error types for pipelines. Rust doesn’t
have default type parameters for methods, so this function is needed to inform the type
system to default the error type to PipelineError
.
Methods from Deref<Target = Result<(), E>>
#[must_use =
"if you intended to assert that this is ok, consider `.unwrap()` instead"]pub const fn is_ok(&self) -> bool
1.0.0[src]
Returns true
if the result is Ok
.
Examples
Basic usage:
let x: Result<i32, &str> = Ok(-3); assert_eq!(x.is_ok(), true); let x: Result<i32, &str> = Err("Some error message"); assert_eq!(x.is_ok(), false);
#[must_use =
"if you intended to assert that this is err, consider `.unwrap_err()` instead"]pub const fn is_err(&self) -> bool
1.0.0[src]
Returns true
if the result is Err
.
Examples
Basic usage:
let x: Result<i32, &str> = Ok(-3); assert_eq!(x.is_err(), false); let x: Result<i32, &str> = Err("Some error message"); assert_eq!(x.is_err(), true);
#[must_use]pub fn contains<U>(&self, x: &U) -> bool where
U: PartialEq<T>,
[src]
U: PartialEq<T>,
option_result_contains
)Returns true
if the result is an Ok
value containing the given value.
Examples
#![feature(option_result_contains)] let x: Result<u32, &str> = Ok(2); assert_eq!(x.contains(&2), true); let x: Result<u32, &str> = Ok(3); assert_eq!(x.contains(&2), false); let x: Result<u32, &str> = Err("Some error message"); assert_eq!(x.contains(&2), false);
#[must_use]pub fn contains_err<F>(&self, f: &F) -> bool where
F: PartialEq<E>,
[src]
F: PartialEq<E>,
result_contains_err
)Returns true
if the result is an Err
value containing the given value.
Examples
#![feature(result_contains_err)] let x: Result<u32, &str> = Ok(2); assert_eq!(x.contains_err(&"Some error message"), false); let x: Result<u32, &str> = Err("Some error message"); assert_eq!(x.contains_err(&"Some error message"), true); let x: Result<u32, &str> = Err("Some other error message"); assert_eq!(x.contains_err(&"Some error message"), false);
pub const fn as_ref(&self) -> Result<&T, &E>
1.0.0[src]
Converts from &Result<T, E>
to Result<&T, &E>
.
Produces a new Result
, containing a reference
into the original, leaving the original in place.
Examples
Basic usage:
let x: Result<u32, &str> = Ok(2); assert_eq!(x.as_ref(), Ok(&2)); let x: Result<u32, &str> = Err("Error"); assert_eq!(x.as_ref(), Err(&"Error"));
pub fn as_mut(&mut self) -> Result<&mut T, &mut E>
1.0.0[src]
Converts from &mut Result<T, E>
to Result<&mut T, &mut E>
.
Examples
Basic usage:
fn mutate(r: &mut Result<i32, i32>) { match r.as_mut() { Ok(v) => *v = 42, Err(e) => *e = 0, } } let mut x: Result<i32, i32> = Ok(2); mutate(&mut x); assert_eq!(x.unwrap(), 42); let mut x: Result<i32, i32> = Err(13); mutate(&mut x); assert_eq!(x.unwrap_err(), 0);
pub fn iter(&self) -> Iter<'_, T>
1.0.0[src]
Returns an iterator over the possibly contained value.
The iterator yields one value if the result is Result::Ok
, otherwise none.
Examples
Basic usage:
let x: Result<u32, &str> = Ok(7); assert_eq!(x.iter().next(), Some(&7)); let x: Result<u32, &str> = Err("nothing!"); assert_eq!(x.iter().next(), None);
pub fn iter_mut(&mut self) -> IterMut<'_, T>
1.0.0[src]
Returns a mutable iterator over the possibly contained value.
The iterator yields one value if the result is Result::Ok
, otherwise none.
Examples
Basic usage:
let mut x: Result<u32, &str> = Ok(7); match x.iter_mut().next() { Some(v) => *v = 40, None => {}, } assert_eq!(x, Ok(40)); let mut x: Result<u32, &str> = Err("nothing!"); assert_eq!(x.iter_mut().next(), None);
pub fn as_deref(&self) -> Result<&<T as Deref>::Target, &E>
1.47.0[src]
Converts from Result<T, E>
(or &Result<T, E>
) to Result<&<T as Deref>::Target, &E>
.
Coerces the Ok
variant of the original Result
via Deref
and returns the new Result
.
Examples
let x: Result<String, u32> = Ok("hello".to_string()); let y: Result<&str, &u32> = Ok("hello"); assert_eq!(x.as_deref(), y); let x: Result<String, u32> = Err(42); let y: Result<&str, &u32> = Err(&42); assert_eq!(x.as_deref(), y);
pub fn as_deref_mut(&mut self) -> Result<&mut <T as Deref>::Target, &mut E>
1.47.0[src]
Converts from Result<T, E>
(or &mut Result<T, E>
) to Result<&mut <T as DerefMut>::Target, &mut E>
.
Coerces the Ok
variant of the original Result
via DerefMut
and returns the new Result
.
Examples
let mut s = "HELLO".to_string(); let mut x: Result<String, u32> = Ok("hello".to_string()); let y: Result<&mut str, &mut u32> = Ok(&mut s); assert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y); let mut i = 42; let mut x: Result<String, u32> = Err(42); let y: Result<&mut str, &mut u32> = Err(&mut i); assert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
Trait Implementations
impl<E> Deref for Render<E>
[src]
type Target = Result<(), E>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<E> DerefMut for Render<E>
[src]
impl<E> From<Render<E>> for Result<(), E>
[src]
Auto Trait Implementations
impl<E> RefUnwindSafe for Render<E> where
E: RefUnwindSafe,
E: RefUnwindSafe,
impl<E> Send for Render<E> where
E: Send,
E: Send,
impl<E> Sync for Render<E> where
E: Sync,
E: Sync,
impl<E> Unpin for Render<E> where
E: Unpin,
E: Unpin,
impl<E> UnwindSafe for Render<E> where
E: UnwindSafe,
E: UnwindSafe,
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>,