Skip to main content

ComponentRegistration

Struct ComponentRegistration 

Source
pub struct ComponentRegistration<'a, C> {
    pub app: &'a mut App,
    /* private fields */
}
Available on crate feature replication only.

Fields§

§app: &'a mut App

Implementations§

Source§

impl<C> ComponentRegistration<'_, C>

Source

pub fn new(app: &mut App) -> ComponentRegistration<'_, C>

Source

pub fn add_map_entities(self) -> ComponentRegistration<'_, C>
where C: Clone + MapEntities + 'static,

Specify that the component contains entities which should be mapped from the remote world to the local world upon deserialization using the component’s MapEntities implementation.

Source

pub fn add_component_map_entities(self) -> ComponentRegistration<'_, C>
where C: Clone + Component + 'static,

Similar to add_map_entities, but uses the Component::map_entities function instead of MapEntities::map_entities

Source

pub fn with_replication_config( self, config: ComponentReplicationConfig, ) -> ComponentRegistration<'_, C>
where C: Component, <C as Component>::Mutability: GetWriteFns<C>,

Source

pub fn add_delta_compression<Delta>(self) -> ComponentRegistration<'_, C>
where C: Component<Mutability = Mutable> + PartialEq + Diffable<Delta>, Delta: Serialize + DeserializeOwned + Message,

Enable delta compression when serializing this component

Source§

impl<C> ComponentRegistration<'_, C>
where C: Debug,

Source

pub fn add_default_hash(self) -> ComponentRegistration<'_, C>
where C: Hash + Component,

Add a hash function for this component using the core::hash::Hash trait implementation.

This will be used to compute a checksum for determinism checks.

Source

pub fn add_custom_hash( self, f: fn(&C, &mut SeaHasher), ) -> ComponentRegistration<'_, C>
where C: Component,

Add a hash function for this component using the core::hash::Hash trait implementation.

This will be used to compute a checksum for determinism checks.

Trait Implementations§

Source§

impl<C> InterpolationRegistrationExt<C> for ComponentRegistration<'_, C>

Source§

fn register_interpolation_fn( self, interpolation_fn: fn(C, C, f32) -> C, ) -> ComponentRegistration<'_, C>
where C: SyncComponent,

Register an interpolation function for this component using the provided LerpFn Read more
Source§

fn register_linear_interpolation(self) -> ComponentRegistration<'_, C>
where C: SyncComponent + Ease,

Register an interpolation function for this component using the Ease implementation Read more
Source§

fn add_interpolation_with( self, interpolation_fn: fn(C, C, f32) -> C, ) -> ComponentRegistration<'_, C>
where C: SyncComponent,

Add interpolation for this component using the provided LerpFn Read more
Source§

fn add_linear_interpolation(self) -> ComponentRegistration<'_, C>
where C: SyncComponent + Ease,

Enable interpolation systems for this component using the Ease implementation Read more
Source§

fn add_custom_interpolation(self) -> ComponentRegistration<'_, C>
where C: Component + Clone,

The remote updates will be stored in a ConfirmedHistory<C> component but the user has to define the interpolation logic themselves (lightyear won’t perform any kind of interpolation)
Source§

impl<C> PredictionRegistrationExt<C> for ComponentRegistration<'_, C>

Source§

fn add_prediction(self) -> ComponentRegistration<'_, C>
where C: SyncComponent,

Enable prediction for this component.
Source§

fn enable_correction(self) -> ComponentRegistration<'_, C>
where C: SyncComponent,

Enables correction for this component, without adding the correction systems. Read more
Source§

fn add_linear_correction_fn<D>(self) -> ComponentRegistration<'_, C>
where C: SyncComponent + Diffable<D>, D: Ease + Debug + Clone + Default + Send + Sync + 'static,

Add correction for this component where the interpolation will done using the lerp function provided by the Ease trait.
Source§

fn add_correction_fn<D>( self, correction_fn: fn(D, D, f32) -> D, ) -> ComponentRegistration<'_, C>
where C: SyncComponent + Diffable<D>, D: Ease + Debug + Clone + Default + Send + Sync + 'static,

Add correction for this component where the interpolation will done using the lerp function provided by the Ease trait. Read more
Source§

fn add_should_rollback( self, should_rollback: fn(&C, &C) -> bool, ) -> ComponentRegistration<'_, C>
where C: SyncComponent,

Add a custom comparison function to determine if we should rollback by comparing the confirmed component with the predicted component’s history.

Auto Trait Implementations§

§

impl<'a, C> Freeze for ComponentRegistration<'a, C>

§

impl<'a, C> !RefUnwindSafe for ComponentRegistration<'a, C>

§

impl<'a, C> !Send for ComponentRegistration<'a, C>

§

impl<'a, C> !Sync for ComponentRegistration<'a, C>

§

impl<'a, C> Unpin for ComponentRegistration<'a, C>
where C: Unpin,

§

impl<'a, C> !UnwindSafe for ComponentRegistration<'a, C>

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

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

Source§

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

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

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

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

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

Converts &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)

Converts &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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
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> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<A> Is for A
where A: Any,

Source§

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

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. Read more
Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the 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<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
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<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

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

Source§

fn vzip(self) -> V

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> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T, U> Captures<U> for T
where T: ?Sized,