Struct Animation

Source
pub struct Animation<T>
where T: EntityId,
{ /* private fields */ }
Expand description

§Overview

Animation allows you to change properties of arbitrary entities at runtime using a set of key frames. Animation consists of multiple tracks, where each track is bound to a property of an entity. A track can animate any numeric properties, starting from numbers (including bool) end ending by 2/3/4 dimensional vectors. Each component (number, x/y/z/w vector components) is stored in a parametric curve (see crate::core::math::curve::Curve docs for more info). Every parametric curve contains zero or more key frames. Graphically this could be represented like so:

                                         Timeline
                                            v
  Time   > |---------------|------------------------------------>
           |               |
  Track1 > | node.position |
           |   X curve     |..1..........5...........10..........
           |   Y curve     |..2.........-2..................1....  < Curve key frames
           |   Z curve     |..1..........9......................4
           |_______________|
  Track2   | node.property |
           | ............  |.....................................
           | ............  |.....................................
           | ............  |.....................................

Each key frame is just a real number with interpolation mode. Interpolation mode tells the engine how to calculate intermediate values between key frames. There are three kinds of interpolation used in animations (you can skip “boring math” if you want):

  • Constant - intermediate value will be calculated using leftmost value of two. Constant “interpolation” is usually used to create step-like behaviour, the most common case is to “interpolate” two boolean values.
  • Linear - intermediate value will be calculated using linear interpolation i = left + (right - left) / t, where t = (time_position - left) / (right - left). t is always in 0..1 range. Linear interpolation is usually used to create “straight” transitions between two values.
  • Cubic - intermediate value will be calculated using Hermite cubic spline: i = (2t^3 - 3t^2 + 1) * left + (t^3 - 2t^2 + t) * left_tangent + (-2t^3 + 3t^2) * right + (t^3 - t^2) * right_tangent, where t = (time_position - left) / (right - left) (t is always in 0..1 range), left_tangent and right_tangent is usually a tan(angle). Cubic interpolation is usually used to create “smooth” transitions between two values.

§Track binding

Each track is always bound to a property in a node, either by its name or by a special binding. The name is used to fetch the property using reflection, the special binding is a faster way of fetching built-in properties. It is usually used to animate position, scale and rotation (these are the most common properties available in every scene node).

§Time slice and looping

While key frames on the curves can be located at arbitrary position in time, animations usually plays a specific time slice. By default, each animation will play on a given time slice infinitely - it is called animation looping, it works in both playback directions.

§Speed

You can vary playback speed in wide range, by default every animation has playback speed multiplier set to 1.0. The multiplier tells how faster (>1) or slower (<1) the animation needs to be played. Negative speed multiplier values will reverse playback.

§Enabling or disabling animations

Sometimes there’s a need to disable/enable an animation or check if it is enabled or not, you can do this by using the pair of respective methods - Animation::set_enabled and Animation::is_enabled.

§Signals

Signal is a named marker on specific time position on the animation timeline. Signal will emit an event if the animation playback time passes signal’s position from left-to-right (or vice versa depending on playback direction). Signals are usually used to attach some specific actions to a position in time. For example, you can have a walking animation and you want to emit sounds when character’s feet touch ground. In this case you need to add a few signals at times when each foot touches the ground. After that all you need to do is to fetch animation events one-by-one and emit respective sounds. See AnimationSignal docs for more info and examples.

§Examples

Usually, animations are created from the editor or some external tool and then imported in the engine. However, sometimes there’s a need for procedural animations. Use the following example code as a guide only if you need to create procedural animations:

fn create_animation(target: ErasedHandle) -> Animation<ErasedHandle> {
    let mut frames_container = TrackDataContainer::new(TrackValueKind::Vector3);

    // We'll animate only X coordinate (at index 0).
    frames_container.curves_mut()[0] = Curve::from(vec![
        CurveKey::new(0.5, 2.0, CurveKeyKind::Linear),
        CurveKey::new(0.75, 1.0, CurveKeyKind::Linear),
        CurveKey::new(1.0, 3.0, CurveKeyKind::Linear),
    ]);

    // Create a track that will animate the node using the curve above.
    let mut track = Track::new(frames_container, ValueBinding::Position);

    // Finally create an animation and set its time slice and turn it on.
    let mut animation = Animation::default();
    animation.add_track_with_binding(TrackBinding::new(target), track);
    animation.set_time_slice(0.0..1.0);
    animation.set_enabled(true);

    animation
}

// Create the animation.
let mut animation = create_animation(Default::default());

// Emulate some ticks (like it was updated from the main loop of your game).
for _ in 0..10 {
    animation.tick(1.0 / 60.0);
}

The code above creates a simple animation that moves a node along X axis in various ways. The usage of the animation is only for the sake of completeness of the example. In the real games you need to add the animation to an animation player scene node and it will do the job for you.

Implementations§

Source§

impl<T> Animation<T>
where T: EntityId,

Source

pub const NAME: &'static str = "name"

Source

pub const TRACKS_DATA: &'static str = "tracks_data"

Source

pub const TRACK_BINDINGS: &'static str = "track_bindings"

Source

pub const TIME_POSITION: &'static str = "time_position"

Source

pub const TIME_SLICE: &'static str = "time_slice"

Source

pub const SPEED: &'static str = "speed"

Source

pub const LOOPED: &'static str = "looped"

Source

pub const ENABLED: &'static str = "enabled"

Source

pub const SIGNALS: &'static str = "signals"

Source

pub const ROOT_MOTION_SETTINGS: &'static str = "root_motion_settings"

Source

pub const MAX_EVENT_CAPACITY: &'static str = "max_event_capacity"

Source§

impl<T> Animation<T>
where T: EntityId,

Source

pub fn get_max_event_capacity(&self) -> usize

Gets the maximum capacity of events.

Source

pub fn set_max_event_capacity(&mut self, max_event_capacity: usize)

Sets the maximum capacity of events.

Source

pub fn set_name<S>(&mut self, name: S)
where S: AsRef<str>,

Sets a new name for the animation. The name then could be used to find the animation in a container.

Source

pub fn name(&self) -> &str

Returns current name of the animation.

Source

pub fn set_tracks_data(&mut self, resource: Resource<AnimationTracksData>)

Sets a new source of data for animation tracks. Keep in mind, that all existing track bindings stored in the animation could become invalid, if the new resource does not have tracks with the same ids that the bindings has.

Source

pub fn tracks_data(&self) -> &Resource<AnimationTracksData>

Returns a reference to the current animation tracks resource.

Source

pub fn fit_length_to_content(&mut self)

Calculates new length of the animation based on the content of its tracks. It looks for the most “right” curve key in all curves of all tracks and treats it as length of the animation. The method could be used in case if you formed animation from code using just curves and don’t know the actual length of the animation.

Source

pub fn set_time_position(&mut self, time: f32) -> &mut Animation<T>

Sets new time position of the animation. The actual time position the animation will have after the call, can be different in two reasons:

  • If the animation is looping and the new time position is outside of the time slice of the animation, then the actual time position will be wrapped to fit the time slice. For example, if you have an animation that has 0.0..5.0s time slice and you trying to set 7.5s position, the actual time position will be 2.5s (it wraps the input value on the given time slice).
  • If the animation is not looping and the new time position is outside of the time slice of the animation, then the actual time position will be clamped to the time clice of the animation.
Source

pub fn set_time_slice(&mut self, time_slice: Range<f32>)

Sets new time slice of the animation in seconds. It defines a time interval in which the animation will be played. Current playback position will be clamped (or wrapped if the animation is looping) to fit to new bounds.

Source

pub fn time_slice(&self) -> Range<f32>

Returns current time slice of the animation.

Source

pub fn rewind(&mut self) -> &mut Animation<T>

Rewinds the animation to the beginning.

Source

pub fn length(&self) -> f32

Returns length of the animation in seconds.

Source

pub fn tick(&mut self, dt: f32)

Performs a single update tick and calculates an output pose. This method is low level, you should not use it in normal circumstances - the engine will call it for you.

Source

pub fn set_root_motion_settings( &mut self, settings: Option<RootMotionSettings<T>>, )

Sets new root motion settings.

Source

pub fn root_motion_settings_ref(&self) -> Option<&RootMotionSettings<T>>

Returns a reference to the root motion settings (if any).

Source

pub fn root_motion_settings_mut(&mut self) -> Option<&mut RootMotionSettings<T>>

Returns a reference to the root motion settings (if any).

Source

pub fn root_motion(&self) -> Option<&RootMotion>

Returns a reference to the root motion (if any).

Source

pub fn pop_event(&mut self) -> Option<AnimationEvent>

Extracts a first event from the events queue of the animation.

Source

pub fn events_ref(&self) -> &VecDeque<AnimationEvent>

Returns a reference to inner events queue. It is useful when you need to iterate over the events, but don’t extract them from the queue.

Source

pub fn events_mut(&mut self) -> &mut VecDeque<AnimationEvent>

Return a mutable reference to inner events queue. Provides you a full controls over animation events, you can even manually inject events in the queue.

Source

pub fn take_events(&mut self) -> VecDeque<AnimationEvent>

Takes the events queue and returns it to the caller, leaving the internal queue empty.

Source

pub fn time_position(&self) -> f32

Returns current time position of the animation. The time position is guaranteed to be in the range of current time slice of the animation.

Source

pub fn set_speed(&mut self, speed: f32) -> &mut Animation<T>

Sets new speed multiplier for the animation. By default it is set to 1.0. Negative values can be used to play the animation in reverse.

Source

pub fn speed(&self) -> f32

Returns speed multiplier of the animation.

Source

pub fn set_loop(&mut self, state: bool) -> &mut Animation<T>

Enables or disables looping of the animation.

Source

pub fn is_loop(&self) -> bool

Returns true if the animation is looping, false - otherwise.

Source

pub fn has_ended(&self) -> bool

Returns true if the animation was played until the end of current time slice of the animation, false - otherwise. Looping animations will always return false.

Source

pub fn set_enabled(&mut self, enabled: bool) -> &mut Animation<T>

Enables or disables the animation, disabled animations does not updated and their output pose will remain the same. By default every animation is enabled.

Source

pub fn is_enabled(&self) -> bool

Returns true if the animation is enabled, false - otherwise.

Source

pub fn add_track_with_binding(&mut self, binding: TrackBinding<T>, track: Track)

Adds a new track to the animation track data container and binds it with the specified target. Keep in mind, that this method will modify potentially shared track data container, which might affect other animations using it.

Source

pub fn pop_track_with_binding(&mut self) -> Option<(TrackBinding<T>, Track)>

Removes last track from the current tracks data resource and the respective binding to it from the animation. This method will fail if the resource is not loaded, or if there’s no tracks in it. It will also fail if there’s no respective binding to the track in the animation.

Keep in mind, that this method modifies the tracks data resource, which might be used by some other animation.

Source

pub fn remove_track_with_binding( &mut self, index: usize, ) -> Option<(TrackBinding<T>, Track)>

Removes the specified track from the current tracks data resource and the respective binding to it from the animation. This method will fail if the resource is not loaded, or if there’s no tracks in it. It will also fail if there’s no respective binding to the track in the animation.

Keep in mind, that this method modifies the tracks data resource, which might be used by some other animation.

Source

pub fn insert_track_with_binding( &mut self, index: usize, binding: TrackBinding<T>, track: Track, )

Inserts a new track in the tracks data resource and creates a new binding to it.

Keep in mind, that this method modifies the tracks data resource, which might be used by some other animation.

Source

pub fn add_signal(&mut self, signal: AnimationSignal) -> &mut Animation<T>

Adds a new animation signal to the animation. See AnimationSignal docs for more info and examples.

Source

pub fn pop_signal(&mut self) -> Option<AnimationSignal>

Removes last animation signal from the container of the animation.

Source

pub fn insert_signal(&mut self, index: usize, signal: AnimationSignal)

Inserts a new animation signal at given position.

Source

pub fn remove_signal(&mut self, index: usize) -> AnimationSignal

Removes an animation signal at given index.

Source

pub fn signals(&self) -> &[AnimationSignal]

Returns a reference to the animation signals container.

Source

pub fn signals_mut(&mut self) -> &mut [AnimationSignal]

Returns a mutable reference to the inner animation signals container, allowing you to modify the signals.

Source

pub fn set_node_track_enabled(&mut self, handle: T, enabled: bool)

Tries to find all tracks that refer to a given node and enables or disables them.

Source

pub fn track_bindings( &self, ) -> &HashMap<Uuid, TrackBinding<T>, BuildHasherDefault<FxHasher>>

Returns a reference to the current set of track bindings used by the animation. The returned hash map contains (track_id -> binding) pairs.

Source

pub fn track_bindings_mut( &mut self, ) -> &mut HashMap<Uuid, TrackBinding<T>, BuildHasherDefault<FxHasher>>

Returns a reference to the current set of track bindings used by the animation. The returned hash map contains (track_id -> binding) pairs.

Source

pub fn find_signal_by_name_ref<S>( &self, name: S, ) -> Option<(usize, &AnimationSignal)>
where S: AsRef<str>,

Tries to find a layer by its name. Returns index of the signal and its reference.

Source

pub fn find_signal_by_name_mut<S>( &mut self, name: S, ) -> Option<(usize, &mut AnimationSignal)>
where S: AsRef<str>,

Tries to find a signal by its name. Returns index of the signal and its reference.

Source

pub fn has_signal<S>(&self, name: S, id: Uuid) -> bool
where S: AsRef<str>,

Returns true if there’s a signal with given name and id.

Source

pub fn remove_tracks(&mut self)

Removes all tracks from the animation.

Source

pub fn pose(&self) -> &AnimationPose<T>

Returns current pose of the animation (a final result that can be applied to a scene graph).

Trait Implementations§

Source§

impl<T> Clone for Animation<T>
where T: EntityId,

Source§

fn clone(&self) -> Animation<T>

Returns a duplicate 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<T> Debug for Animation<T>
where T: Debug + EntityId,

Source§

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

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

impl<T> Default for Animation<T>
where T: EntityId,

Source§

fn default() -> Animation<T>

Returns the “default value” for a type. Read more
Source§

impl<T> NameProvider for Animation<T>
where T: EntityId,

Source§

fn name(&self) -> &str

Returns a reference to the name of the entity.
Source§

impl<T> PartialEq for Animation<T>
where T: PartialEq + EntityId,

Source§

fn eq(&self, other: &Animation<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Reflect for Animation<T>

Source§

fn source_path() -> &'static str

Source§

fn type_name(&self) -> &'static str

Source§

fn doc(&self) -> &'static str

Source§

fn assembly_name(&self) -> &'static str

Returns a parent assembly name of the type that implements this trait. WARNING: You should use proc-macro (#[derive(Reflect)]) to ensure that this method will return correct assembly name. In other words - there’s no guarantee, that any implementation other than proc-macro will return a correct name of the assembly. Alternatively, you can use env!("CARGO_PKG_NAME") as an implementation.
Source§

fn type_assembly_name() -> &'static str

Returns a parent assembly name of the type that implements this trait. WARNING: You should use proc-macro (#[derive(Reflect)]) to ensure that this method will return correct assembly name. In other words - there’s no guarantee, that any implementation other than proc-macro will return a correct name of the assembly. Alternatively, you can use env!("CARGO_PKG_NAME") as an implementation.
Source§

fn fields_info(&self, func: &mut dyn FnMut(&[FieldInfo<'_, '_>]))

Source§

fn into_any(self: Box<Animation<T>>) -> Box<dyn Any>

Source§

fn set( &mut self, value: Box<dyn Reflect>, ) -> Result<Box<dyn Reflect>, Box<dyn Reflect>>

Source§

fn as_any(&self, func: &mut dyn FnMut(&(dyn Any + 'static)))

Source§

fn as_any_mut(&mut self, func: &mut dyn FnMut(&mut (dyn Any + 'static)))

Source§

fn as_reflect(&self, func: &mut dyn FnMut(&(dyn Reflect + 'static)))

Source§

fn as_reflect_mut(&mut self, func: &mut dyn FnMut(&mut (dyn Reflect + 'static)))

Source§

fn fields(&self, func: &mut dyn FnMut(&[&(dyn Reflect + 'static)]))

Source§

fn fields_mut( &mut self, func: &mut dyn FnMut(&mut [&mut (dyn Reflect + 'static)]), )

Source§

fn field( &self, name: &str, func: &mut dyn FnMut(Option<&(dyn Reflect + 'static)>), )

Source§

fn field_mut( &mut self, name: &str, func: &mut dyn FnMut(Option<&mut (dyn Reflect + 'static)>), )

Source§

fn set_field( &mut self, field: &str, value: Box<dyn Reflect>, func: &mut dyn FnMut(Result<Box<dyn Reflect>, Box<dyn Reflect>>), )

Calls user method specified with #[reflect(setter = ..)] or falls back to Reflect::field_mut
Source§

fn as_array(&self, func: &mut dyn FnMut(Option<&(dyn ReflectArray + 'static)>))

Source§

fn as_array_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectArray + 'static)>), )

Source§

fn as_list(&self, func: &mut dyn FnMut(Option<&(dyn ReflectList + 'static)>))

Source§

fn as_list_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectList + 'static)>), )

Source§

fn as_inheritable_variable( &self, func: &mut dyn FnMut(Option<&(dyn ReflectInheritableVariable + 'static)>), )

Source§

fn as_inheritable_variable_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectInheritableVariable + 'static)>), )

Source§

fn as_hash_map( &self, func: &mut dyn FnMut(Option<&(dyn ReflectHashMap + 'static)>), )

Source§

fn as_hash_map_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectHashMap + 'static)>), )

Source§

impl<T> TypeUuidProvider for Animation<T>
where T: EntityId,

Source§

fn type_uuid() -> Uuid

Return type UUID.
Source§

impl<T> Visit for Animation<T>
where T: EntityId,

Source§

fn visit(&mut self, name: &str, visitor: &mut Visitor) -> Result<(), VisitError>

Read or write this value, depending on whether Visitor::is_reading() is true or false. Read more
Source§

impl<T> StructuralPartialEq for Animation<T>
where T: EntityId,

Auto Trait Implementations§

§

impl<T> Freeze for Animation<T>
where T: Freeze,

§

impl<T> !RefUnwindSafe for Animation<T>

§

impl<T> Send for Animation<T>

§

impl<T> Sync for Animation<T>
where T: Sync,

§

impl<T> Unpin for Animation<T>
where T: Unpin,

§

impl<T> !UnwindSafe for Animation<T>

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> AsyncTaskResult for T
where T: Any + Send + 'static,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts self reference as a reference to Any. Could be used to downcast a trait object to a particular type.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts self reference as a reference to Any. Could be used to downcast a trait object to a particular type.
Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> FieldValue for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Casts self to a &dyn Any
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<R> GetField for R
where R: Reflect,

Source§

fn get_field<T>(&self, name: &str, func: &mut dyn FnMut(Option<&T>))
where T: 'static,

Source§

fn get_field_mut<T>(&mut self, name: &str, func: &mut dyn FnMut(Option<&mut T>))
where T: 'static,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MessageData for T
where T: 'static + Debug + PartialEq + Any + Send + Clone,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Casts self as Any reference.
Source§

fn compare(&self, other: &(dyn MessageData + 'static)) -> bool

Compares this message data with some other.
Source§

fn clone_box(&self) -> Box<dyn MessageData>

Clones self as boxed value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> ReflectBase for T
where T: Reflect,

Source§

fn as_any_raw(&self) -> &(dyn Any + 'static)

Source§

fn as_any_raw_mut(&mut self) -> &mut (dyn Any + 'static)

Source§

impl<T> ResolvePath for T
where T: Reflect,

Source§

fn resolve_path<'p>( &self, path: &'p str, func: &mut dyn FnMut(Result<&(dyn Reflect + 'static), ReflectPathError<'p>>), )

Source§

fn resolve_path_mut<'p>( &mut self, path: &'p str, func: &mut dyn FnMut(Result<&mut (dyn Reflect + 'static), ReflectPathError<'p>>), )

Source§

fn get_resolve_path<'p, T>( &self, path: &'p str, func: &mut dyn FnMut(Result<&T, ReflectPathError<'p>>), )
where T: Reflect,

Source§

fn get_resolve_path_mut<'p, T>( &mut self, path: &'p str, func: &mut dyn FnMut(Result<&mut T, ReflectPathError<'p>>), )
where T: Reflect,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ScriptMessagePayload for T
where T: 'static + Send + Debug,

Source§

fn as_any_ref(&self) -> &(dyn Any + 'static)

Returns self as &dyn Any
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Returns self as &dyn Any
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

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

Source§

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

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Value for T
where T: Reflect + Clone + Debug + Send,

Source§

fn clone_box(&self) -> Box<dyn Value>

Source§

fn into_box_reflect(self: Box<T>) -> Box<dyn Reflect>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> CollectionItem for T
where T: Clone + Reflect + Debug + Default + TypeUuidProvider + Send + 'static,

Source§

impl<T> InspectableEnum for T
where T: Debug + Reflect + Clone + TypeUuidProvider + Send + 'static,

Source§

impl<T> ResourceLoadError for T
where T: 'static + Debug + Send + Sync,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<T> SpriteSheetTexture for T
where T: PartialEq + Clone + Visit + Reflect + 'static,