Skip to main content

ScreenResult

Struct ScreenResult 

Source
pub struct ScreenResult { /* private fields */ }
Expand description

A value a screen pops with (Transition::PopWith) for the screen below, which reads it back as its type in Screen::uncovered. Any 'static type will do; the two screens agree on which.

Implementations§

Source§

impl ScreenResult

Source

pub fn new<T>(value: T) -> ScreenResult
where T: Any,

value, to hand to the screen below.

Source

pub fn is<T>(&self) -> bool
where T: Any,

Whether the value is a T.

Source

pub fn get<T>(&self) -> Option<&T>
where T: Any,

The value, if it is a T.

Source

pub fn take<T>(self) -> Option<T>
where T: Any,

The value, if it is a T; dropped if it isn’t.

Source

pub fn downcast<T>(self) -> Result<T, ScreenResult>
where T: Any,

The value, if it is a T.

§Errors

The result itself, unchanged, when its value is not a T.

Trait Implementations§

Source§

impl Debug for ScreenResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.