pub struct SystemUtils;Expand description
系统工具集合
提供常用的系统开发工具和辅助函数。
Implementations§
Source§impl SystemUtils
impl SystemUtils
Sourcepub fn conditional_system<S, C>(
system: S,
condition: C,
) -> impl IntoSystemConfigs<()>
pub fn conditional_system<S, C>( system: S, condition: C, ) -> impl IntoSystemConfigs<()>
创建条件系统
根据提供的条件函数创建一个条件系统,只有当条件为真时才执行。
§参数
condition: 条件函数system: 要执行的系统
§示例
use anvilkit_ecs::prelude::*;
use anvilkit_ecs::schedule::AnvilKitSchedule;
fn debug_condition() -> bool {
cfg!(debug_assertions)
}
fn debug_system() {
println!("调试模式下执行");
}
let mut app = App::new();
app.add_systems(AnvilKitSchedule::Update, debug_system.run_if(debug_condition));Sourcepub fn timed_system<M, S>(
_interval: f32,
system: S,
) -> impl IntoSystemConfigs<M>where
S: IntoSystemConfigs<M>,
👎Deprecated since 0.2.0: 不提供定时功能,请使用 Time resource + Local<Timer> 实现
pub fn timed_system<M, S>(
_interval: f32,
system: S,
) -> impl IntoSystemConfigs<M>where
S: IntoSystemConfigs<M>,
不提供定时功能,请使用 Time resource + Local<Timer> 实现
Auto Trait Implementations§
impl Freeze for SystemUtils
impl RefUnwindSafe for SystemUtils
impl Send for SystemUtils
impl Sync for SystemUtils
impl Unpin for SystemUtils
impl UnsafeUnpin for SystemUtils
impl UnwindSafe for SystemUtils
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
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>
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)
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)
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.