Struct tween::Tweener

source ·
pub struct Tweener<Value, Time, T: ?Sized> {
    pub current_time: Time,
    pub duration: Time,
    pub tween: T,
    /* private fields */
}
Expand description

A Tweener is a wrapper around a Tween. Although you can tween dynamically using just a raw Tween, this struct will manage state and allow for more naturalistic handling.

When you create a Tweener, you’ll provide the start, end, and duration of the Tween (along with the actual tween itself). All of these are in absolute values. Internally, the Tweener, as with this library, works in “parametric” space, which is a fancy way of describing 0.0..=1.0, or a percentage of the Tween.

This struct has two important methods: move_to and move_by. move_to effectively just moves your time into parametric space (ie, takes a tween of length 4, and time 2, and gets the percent 0.5) and clamps the output to the start and end value in case you tried to move_to a time beyond the tween’s duration (a negative time, or a time > duration). move_by does the same, but given a relative value.

§Clamping

A Tweener clamps its output value to within the range of start..=end given in new. This can easily happen moving a Tweener with move_by. To check if that’s occured, use is_finished, or, if negative movement is possible, invert is_valid.

For most users of this library, a common pattern will be:


let (start, end) = (0, 100);
let duration = 1;
let mut tweener = Tweener::linear(start, end, duration);

// and then in your main loop...
let dt = 1;
let mut last_value = None;
loop {
    last_value = Some(tweener.move_by(dt));
    // we'd want to run `!is_valid()` if negative movement was possible, but we know its not.
    if tweener.is_finished() {
        break;
    }
}
assert_eq!(last_value, Some(100));

What is finished and what is started exactly, though? In this library is_finished returns true when the Time is at or beyond the duration of the Tweener. This is a fancy way of saying if the Tweener has ran 5 frames, and its duration was 5, it will return true on is_finished.

We can demonstrate that here:

let (start, end) = (0, 2);
let duration = 2;
let mut tweener = Tweener::linear(start, end, duration);

let mut accum = 0;

loop {
    accum += dbg!(tweener.move_by(1));
    if tweener.is_finished() {
        break;
    }
}

assert_eq!(accum, 3);

NB: this is probably your assumption as to how this library works, but does mean that in a loop constructed like so, you will never actually see a clamp occur within move_by.

Finally, if you’d like this library to actually not clamp your tween, take a look at Extrapolator.

§Iterator

In situations where the same delta time is alwayas used for move_by, you can instead convert a Tweener into a FixedTweener by into_fixed. See FixedTweener for more information.

Fields§

§current_time: Time

The current time of the Tweener. You can change this value at will without running the Tween, or change it with move_by.

§duration: Time

The Tweener’s total duration.

§tween: T

The actual underlying Tween.

Implementations§

source§

impl<Value, Time, T> Tweener<Value, Time, T>
where Time: TweenTime, Value: TweenValue, T: Tween<Value>,

source

pub fn new(start: Value, end: Value, duration: Time, tween: T) -> Self

Creates a new Tweener out of a Tween, start and end TweenValue, and TweenTime duration.

source

pub fn new_at( start: Value, end: Value, duration: Time, tween: T, current_time: Time ) -> Self

Creates a new Tweener out of a Tween, start and end TweenValue, TweenTime duration, and TweenTime current time.

Use this to have “negative” times in Tweeners. This can be useful for starting tweens “with a delay”. See the example in examples/delayed_tween.rs

source

pub fn map<R: Tween<Value>>( self, f: impl FnMut(T) -> R ) -> Tweener<Value, Time, R>

Maps a Tweener<Value, Time, T> to a Tweener<Value, Time, R>. This can be useful for boxing inner tweens.

source

pub fn move_to(&mut self, position: Time) -> Value

Moves the tween to a given Time. If this Tween previously was outside 0..=1 in parametric (percentage) space, ie. outside the duration of the tween or in negative time, this can move it back into bounds.

Giving TweenTime::ZERO to this function effectively resets a tweener.

Giving a negative time or a time beyond duration will move the tween there, but we will always clamp the output time.

source

pub fn move_by(&mut self, delta: Time) -> Value

Drives the Tweener forward X steps in time.

If an input higher than the tween’s duration is given, you will receive the max value of the tween.

source

pub fn initial_value(&self) -> Value

The initial value a tween was set to start at.

source

pub fn final_value(&self) -> Value

The final value the tween should end at.

source

pub fn is_started(&self) -> bool

Returns true is the Tweener’s current_time is greater than or equal to 0. Only negative times will return false.

Note that for tweens without bounds (infinite tweens like Looper), this method will always return true. Moreover, this method does not check if a tweener is finished. For that, use is_finished.

source

pub fn is_finished(&self) -> bool

Returns true is the Tweener’s current_time is greater than or equal to duration.

Note that for tweens without bounds (infinite tweens like Looper), this method will always return false. Moreover, this method does not check if a tweener is started. For that, use is_started.

source

pub fn is_valid(&self) -> bool

Returns true is the Tweener’s current_time is greater than or equal to 0 but less than duration.

Note that for tweens without bounds (infinite tweens like Looper), this method will always return true.

This method is rarely needed – only use it if you are doing some second-order tweening.

source

pub fn current_time_state(&self) -> CurrentTimeState

Returns CurrentTimeState based on the Tweener’s current_time.

Note that for tweens without bounds (in this library, Looper, Oscillator, and Extrapolator), this method will always return CurrentTimeState::Valid.

source

pub fn into_fixed(self, delta: Time) -> FixedTweener<Value, Time, T>

Converts this Tweener to a FixedTweener. See its documentation for more information.

source§

impl<Value, Time> Tweener<Value, Time, Linear>
where Time: TweenTime, Value: TweenValue,

source

pub fn linear( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, Linear>

Creates a new Linear Tweener.

source

pub fn linear_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, Linear>

Creates a new Linear Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, CubicIn>
where Time: TweenTime, Value: TweenValue,

source

pub fn cubic_in( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, CubicIn>

Creates a new CubicIn Tweener.

source

pub fn cubic_in_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, CubicIn>

Creates a new CubicIn Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, CubicOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn cubic_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, CubicOut>

Creates a new CubicOut Tweener.

source

pub fn cubic_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, CubicOut>

Creates a new CubicOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, CubicInOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn cubic_in_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, CubicInOut>

Creates a new CubicInOut Tweener.

source

pub fn cubic_in_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, CubicInOut>

Creates a new CubicInOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, SineIn>
where Time: TweenTime, Value: TweenValue,

source

pub fn sine_in( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, SineIn>

Creates a new SineIn Tweener.

source

pub fn sine_in_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, SineIn>

Creates a new SineIn Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, SineOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn sine_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, SineOut>

Creates a new SineOut Tweener.

source

pub fn sine_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, SineOut>

Creates a new SineOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, SineInOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn sine_in_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, SineInOut>

Creates a new SineOut Tweener.

source

pub fn sine_in_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, SineInOut>

Creates a new SineOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, QuintIn>
where Time: TweenTime, Value: TweenValue,

source

pub fn quint_in( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, QuintIn>

Creates a new QuintInOut Tweener.

source

pub fn quint_in_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, QuintIn>

Creates a new QuintInOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, QuintOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn quint_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, QuintOut>

Creates a new QuintOut Tweener.

source

pub fn quint_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, QuintOut>

Creates a new QuintOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, QuintInOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn quint_in_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, QuintInOut>

Creates a new QuintInOut Tweener.

source

pub fn quint_in_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, QuintInOut>

Creates a new QuintInOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, QuadIn>
where Time: TweenTime, Value: TweenValue,

source

pub fn quad_in( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, QuadIn>

Creates a new QuadIn Tweener.

source

pub fn quad_in_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, QuadIn>

Creates a new QuadIn Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, QuadOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn quad_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, QuadOut>

Creates a new QuadOut Tweener.

source

pub fn quad_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, QuadOut>

Creates a new QuadOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, QuadInOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn quad_in_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, QuadInOut>

Creates a new QuadInOut Tweener.

source

pub fn quad_in_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, QuadInOut>

Creates a new QuadInOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, QuartIn>
where Time: TweenTime, Value: TweenValue,

source

pub fn quart_in( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, QuartIn>

Creates a new QuartIn Tweener.

source

pub fn quart_in_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, QuartIn>

Creates a new QuartIn Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, QuartOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn quart_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, QuartOut>

Creates a new QuartOut Tweener.

source

pub fn quart_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, QuartOut>

Creates a new QuartOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, QuartInOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn quart_in_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, QuartInOut>

Creates a new QuartInOut Tweener.

source

pub fn quart_in_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, QuartInOut>

Creates a new QuartInOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, ExpoIn>
where Time: TweenTime, Value: TweenValue,

source

pub fn expo_in( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, ExpoIn>

Creates a new ExpoIn Tweener.

source

pub fn expo_in_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, ExpoIn>

Creates a new ExpoIn Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, ExpoOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn expo_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, ExpoOut>

Creates a new ExpoOut Tweener.

source

pub fn expo_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, ExpoOut>

Creates a new ExpoOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, ExpoInOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn expo_in_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, ExpoInOut>

Creates a new ExpoInOut Tweener.

source

pub fn expo_in_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, ExpoInOut>

Creates a new ExpoInOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, CircIn>
where Time: TweenTime, Value: TweenValue,

source

pub fn circ_in( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, CircIn>

Creates a new CircIn Tweener.

source

pub fn circ_in_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, CircIn>

Creates a new CircIn Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, CircOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn circ_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, CircOut>

Creates a new CircOut Tweener.

source

pub fn circ_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, CircOut>

Creates a new CircOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, CircInOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn circ_in_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, CircInOut>

Creates a new CircInOut Tweener.

source

pub fn circ_in_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, CircInOut>

Creates a new CircInOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, BackIn>
where Time: TweenTime, Value: TweenValue,

source

pub fn back_in( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, BackIn>

Creates a new BackIn Tweener.

source

pub fn back_in_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, BackIn>

Creates a new BackIn Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, BackOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn back_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, BackOut>

Creates a new BackOut Tweener.

source

pub fn back_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, BackOut>

Creates a new BackOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, BackInOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn back_in_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, BackInOut>

Creates a new BackInOut Tweener.

source

pub fn back_in_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, BackInOut>

Creates a new BackInOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, ElasticIn>
where Time: TweenTime, Value: TweenValue,

source

pub fn elastic_in( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, ElasticIn>

Creates a new ElasticIn Tweener.

source

pub fn elastic_in_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, ElasticIn>

Creates a new ElasticIn Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, ElasticOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn elastic_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, ElasticOut>

Creates a new ElasticOut Tweener.

source

pub fn elastic_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, ElasticOut>

Creates a new ElasticOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, ElasticInOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn elastic_in_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, ElasticInOut>

Creates a new ElasticInOut Tweener.

source

pub fn elastic_in_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, ElasticInOut>

Creates a new ElasticInOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, BounceIn>
where Time: TweenTime, Value: TweenValue,

source

pub fn bounce_in( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, BounceIn>

Creates a new BounceIn Tweener.

source

pub fn bounce_in_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, BounceIn>

Creates a new BounceIn Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, BounceOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn bounce_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, BounceOut>

Creates a new BounceOut Tweener.

source

pub fn bounce_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, BounceOut>

Creates a new BounceOut Tweener at the given time.

source§

impl<Value, Time> Tweener<Value, Time, BounceInOut>
where Time: TweenTime, Value: TweenValue,

source

pub fn bounce_in_out( start: Value, end: Value, duration: Time ) -> Tweener<Value, Time, BounceInOut>

Creates a new BounceInOut Tweener.

source

pub fn bounce_in_out_at( start: Value, end: Value, duration: Time, current_time: Time ) -> Tweener<Value, Time, BounceInOut>

Creates a new BounceInOut Tweener at the given time.

Trait Implementations§

source§

impl<Value: Clone, Time: Clone, T: Clone + ?Sized> Clone for Tweener<Value, Time, T>

source§

fn clone(&self) -> Tweener<Value, Time, T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Value: Debug, Time: Debug, T: Debug + ?Sized> Debug for Tweener<Value, Time, T>

source§

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

Formats the value using the given formatter. Read more
source§

impl<Value: Ord, Time: Ord, T: Ord + ?Sized> Ord for Tweener<Value, Time, T>

source§

fn cmp(&self, other: &Tweener<Value, Time, T>) -> Ordering

This method returns an Ordering between self and other. Read more
source§

impl<Value: PartialEq, Time: PartialEq, T: PartialEq + ?Sized> PartialEq for Tweener<Value, Time, T>

source§

fn eq(&self, other: &Tweener<Value, Time, T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Value: PartialOrd, Time: PartialOrd, T: PartialOrd + ?Sized> PartialOrd for Tweener<Value, Time, T>

source§

fn partial_cmp(&self, other: &Tweener<Value, Time, T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<Value: Copy, Time: Copy, T: Copy + ?Sized> Copy for Tweener<Value, Time, T>

source§

impl<Value: Eq, Time: Eq, T: Eq + ?Sized> Eq for Tweener<Value, Time, T>

source§

impl<Value, Time, T: ?Sized> StructuralPartialEq for Tweener<Value, Time, T>

Auto Trait Implementations§

§

impl<Value, Time, T> Freeze for Tweener<Value, Time, T>
where Time: Freeze, Value: Freeze, T: Freeze + ?Sized,

§

impl<Value, Time, T> RefUnwindSafe for Tweener<Value, Time, T>
where Time: RefUnwindSafe, Value: RefUnwindSafe, T: RefUnwindSafe + ?Sized,

§

impl<Value, Time, T> Send for Tweener<Value, Time, T>
where Time: Send, Value: Send, T: Send + ?Sized,

§

impl<Value, Time, T> Sync for Tweener<Value, Time, T>
where Time: Sync, Value: Sync, T: Sync + ?Sized,

§

impl<Value, Time, T> Unpin for Tweener<Value, Time, T>
where Time: Unpin, Value: Unpin, T: Unpin + ?Sized,

§

impl<Value, Time, T> UnwindSafe for Tweener<Value, Time, T>
where Time: UnwindSafe, Value: UnwindSafe, T: UnwindSafe + ?Sized,

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
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.