pub struct App {
pub strict_mode: bool,
pub safe_mode: bool,
pub rust_constructor_resource: Vec<Box<dyn RustConstructorResource>>,
pub render_resource_list: Vec<RenderResource>,
pub problem_list: Vec<Problem>,
pub tick_interval: f32,
pub current_page: String,
pub timer: Timer,
pub frame_times: Vec<f32>,
pub last_frame_time: Option<f64>,
}Expand description
程序主体。
Fields§
§strict_mode: bool配置项,用于控制出现问题时是否panic。
safe_mode: bool配置项,用于全局控制是否在调用资源时检查资源是否存在。
rust_constructor_resource: Vec<Box<dyn RustConstructorResource>>RC资源。
render_resource_list: Vec<RenderResource>渲染资源列表。
problem_list: Vec<Problem>问题列表。
tick_interval: f32RC资源刷新率。
current_page: String当前页面。
timer: Timer计时器。
frame_times: Vec<f32>帧时间。
last_frame_time: Option<f64>上一帧时间。
Implementations§
Source§impl App
impl App
pub fn strict_mode(self, strict_mode: bool) -> Self
pub fn safe_mode(self, safe_mode: bool) -> Self
pub fn tick_interval(self, tick_interval: f32) -> Self
pub fn current_page(self, current_page: &str) -> Self
Sourcepub fn page_handler(&mut self, ctx: &Context)
pub fn page_handler(&mut self, ctx: &Context)
整合所有页面需要一次性处理的功能。
Sourcepub fn switch_page(
&mut self,
name: &str,
safe_mode: Option<bool>,
) -> Result<(), RustConstructorError>
pub fn switch_page( &mut self, name: &str, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>
切换页面。
Sourcepub fn replace_resource_custom<T>(
&self,
name: &str,
discern_type: &str,
resource: T,
target: Vec<Box<dyn RustConstructorResource>>,
) -> Result<(), RustConstructorError>where
T: RustConstructorResource + 'static,
pub fn replace_resource_custom<T>(
&self,
name: &str,
discern_type: &str,
resource: T,
target: Vec<Box<dyn RustConstructorResource>>,
) -> Result<(), RustConstructorError>where
T: RustConstructorResource + 'static,
从指定列表中替换资源。
Sourcepub fn replace_resource<T>(
&mut self,
name: &str,
discern_type: &str,
resource: T,
) -> Result<(), RustConstructorError>where
T: RustConstructorResource + 'static,
pub fn replace_resource<T>(
&mut self,
name: &str,
discern_type: &str,
resource: T,
) -> Result<(), RustConstructorError>where
T: RustConstructorResource + 'static,
从列表中替换资源。
Sourcepub fn get_resource<T>(
&self,
name: &str,
discern_type: &str,
) -> Result<Option<&T>, RustConstructorError>where
T: RustConstructorResource + 'static,
pub fn get_resource<T>(
&self,
name: &str,
discern_type: &str,
) -> Result<Option<&T>, RustConstructorError>where
T: RustConstructorResource + 'static,
从列表中获取不可变资源。
Sourcepub fn get_resource_mut<T>(
&mut self,
name: &str,
discern_type: &str,
) -> Result<&mut T, RustConstructorError>where
T: RustConstructorResource + 'static,
pub fn get_resource_mut<T>(
&mut self,
name: &str,
discern_type: &str,
) -> Result<&mut T, RustConstructorError>where
T: RustConstructorResource + 'static,
从列表中获取可变资源。
Sourcepub fn check_resource_exists(&self, name: &str, discern_type: &str) -> bool
pub fn check_resource_exists(&self, name: &str, discern_type: &str) -> bool
检查是否存在特定资源。
Sourcepub fn font(
&mut self,
name: &str,
safe_mode: Option<bool>,
) -> Result<FontDefinitions, RustConstructorError>
pub fn font( &mut self, name: &str, safe_mode: Option<bool>, ) -> Result<FontDefinitions, RustConstructorError>
输出字体资源。
Sourcepub fn register_all_fonts(&mut self, ctx: &Context, safe_mode: Option<bool>)
pub fn register_all_fonts(&mut self, ctx: &Context, safe_mode: Option<bool>)
将所有已添加到RC的字体资源添加到egui中。
Sourcepub fn problem_report(
&mut self,
problem_type: RustConstructorError,
severity_level: SeverityLevel,
)
pub fn problem_report( &mut self, problem_type: RustConstructorError, severity_level: SeverityLevel, )
发生问题时推送报告。
Sourcepub fn problem_report_custom(
&self,
problem_type: RustConstructorError,
severity_level: SeverityLevel,
problem_storage: Vec<Problem>,
)
pub fn problem_report_custom( &self, problem_type: RustConstructorError, severity_level: SeverityLevel, problem_storage: Vec<Problem>, )
发生问题时向指定列表推送报告。
Sourcepub fn check_updated(
&mut self,
name: &str,
safe_mode: Option<bool>,
) -> Result<bool, RustConstructorError>
pub fn check_updated( &mut self, name: &str, safe_mode: Option<bool>, ) -> Result<bool, RustConstructorError>
检查页面是否已完成首次加载。
Sourcepub fn check_enter_updated(
&mut self,
name: &str,
safe_mode: Option<bool>,
) -> Result<bool, RustConstructorError>
pub fn check_enter_updated( &mut self, name: &str, safe_mode: Option<bool>, ) -> Result<bool, RustConstructorError>
检查页面是否已完成加载。
Sourcepub fn new_page_update(
&mut self,
name: &str,
safe_mode: Option<bool>,
) -> Result<(), RustConstructorError>
pub fn new_page_update( &mut self, name: &str, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>
进入新页面时的更新。
Sourcepub fn update_frame_stats(&mut self, ctx: &Context)
pub fn update_frame_stats(&mut self, ctx: &Context)
更新帧数。
Sourcepub fn current_fps(&self) -> f32
pub fn current_fps(&self) -> f32
更新帧数显示。
Sourcepub fn add_split_time(&mut self, split_time: SplitTime)
pub fn add_split_time(&mut self, split_time: SplitTime)
添加分段时间。
Sourcepub fn reset_split_time(
&mut self,
name: &str,
safe_mode: Option<bool>,
) -> Result<(), RustConstructorError>
pub fn reset_split_time( &mut self, name: &str, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>
重置分段时间。
Sourcepub fn split_time(
&self,
name: &str,
safe_mode: Option<bool>,
) -> Result<[f32; 2], RustConstructorError>
pub fn split_time( &self, name: &str, safe_mode: Option<bool>, ) -> Result<[f32; 2], RustConstructorError>
输出分段时间。
Sourcepub fn update_timer(&mut self)
pub fn update_timer(&mut self)
更新计时器。
Sourcepub fn add_custom_rect(&mut self, custom_rect: CustomRect)
pub fn add_custom_rect(&mut self, custom_rect: CustomRect)
添加矩形资源。
Sourcepub fn custom_rect(
&mut self,
name: &str,
ui: &mut Ui,
ctx: &Context,
safe_mode: Option<bool>,
) -> Result<(), RustConstructorError>
pub fn custom_rect( &mut self, name: &str, ui: &mut Ui, ctx: &Context, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>
显示矩形资源。
Sourcepub fn text(
&mut self,
name: &str,
ui: &mut Ui,
ctx: &Context,
safe_mode: Option<bool>,
) -> Result<(), RustConstructorError>
pub fn text( &mut self, name: &str, ui: &mut Ui, ctx: &Context, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>
显示文本资源。
Sourcepub fn modify_var<T: Debug + 'static>(
&mut self,
name: &str,
value: Option<T>,
safe_mode: Option<bool>,
) -> Result<(), RustConstructorError>
pub fn modify_var<T: Debug + 'static>( &mut self, name: &str, value: Option<T>, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>
修改变量资源。
Sourcepub fn var<T: Debug + 'static>(
&self,
name: &str,
safe_mode: Option<bool>,
) -> Result<Option<&T>, RustConstructorError>
pub fn var<T: Debug + 'static>( &self, name: &str, safe_mode: Option<bool>, ) -> Result<Option<&T>, RustConstructorError>
取出变量。
Sourcepub fn add_image_texture(
&mut self,
image_texture: ImageTexture,
path: &str,
flip: [bool; 2],
ctx: &Context,
)
pub fn add_image_texture( &mut self, image_texture: ImageTexture, path: &str, flip: [bool; 2], ctx: &Context, )
添加图片纹理资源。
Sourcepub fn image_texture(
&self,
name: &str,
safe_mode: Option<bool>,
) -> Result<Option<DebugTextureHandle>, RustConstructorError>
pub fn image_texture( &self, name: &str, safe_mode: Option<bool>, ) -> Result<Option<DebugTextureHandle>, RustConstructorError>
输出图片纹理。
Sourcepub fn reset_image_texture(
&mut self,
name: &str,
path: &str,
flip: [bool; 2],
ctx: &Context,
safe_mode: Option<bool>,
) -> Result<(), RustConstructorError>
pub fn reset_image_texture( &mut self, name: &str, path: &str, flip: [bool; 2], ctx: &Context, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>
重置图片纹理。
Sourcepub fn add_image(
&mut self,
image: Image,
image_texture_name: &str,
safe_mode: Option<bool>,
) -> Result<(), RustConstructorError>
pub fn add_image( &mut self, image: Image, image_texture_name: &str, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>
添加图片资源。
Sourcepub fn image(
&mut self,
name: &str,
ui: &mut Ui,
ctx: &Context,
safe_mode: Option<bool>,
) -> Result<(), RustConstructorError>
pub fn image( &mut self, name: &str, ui: &mut Ui, ctx: &Context, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>
显示图片资源。
Sourcepub fn add_message_box(
&mut self,
message_box: MessageBox,
title_name: &str,
content_name: &str,
image_name: &str,
close_switch_fill_resource_name: &str,
close_switch_fill_resource_type: &str,
safe_mode: Option<bool>,
) -> Result<(), RustConstructorError>
pub fn add_message_box( &mut self, message_box: MessageBox, title_name: &str, content_name: &str, image_name: &str, close_switch_fill_resource_name: &str, close_switch_fill_resource_type: &str, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>
添加消息框资源。
Sourcepub fn message_box_display(
&mut self,
ctx: &Context,
ui: &mut Ui,
safe_mode: Option<bool>,
)
pub fn message_box_display( &mut self, ctx: &Context, ui: &mut Ui, safe_mode: Option<bool>, )
处理所有已添加的消息框资源。
Sourcepub fn add_switch(
&mut self,
switch: Switch,
fill_resource_name: &str,
fill_resource_type: &str,
text_name: &str,
) -> Result<(), RustConstructorError>
pub fn add_switch( &mut self, switch: Switch, fill_resource_name: &str, fill_resource_type: &str, text_name: &str, ) -> Result<(), RustConstructorError>
添加开关资源。
Sourcepub fn switch(
&mut self,
name: &str,
ui: &mut Ui,
ctx: &Context,
enable: bool,
safe_mode: Option<bool>,
) -> Result<(), RustConstructorError>
pub fn switch( &mut self, name: &str, ui: &mut Ui, ctx: &Context, enable: bool, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>
显示开关资源。
Sourcepub fn check_switch_data(
&self,
name: &str,
safe_mode: Option<bool>,
) -> Result<SwitchData, RustConstructorError>
pub fn check_switch_data( &self, name: &str, safe_mode: Option<bool>, ) -> Result<SwitchData, RustConstructorError>
查找指定开关的常用判定字段集合。
Sourcepub fn add_mouse_detector(&mut self, mouse_detector: MouseDetector)
pub fn add_mouse_detector(&mut self, mouse_detector: MouseDetector)
添加鼠标检测器资源。
pub fn mouse_detector( &mut self, name: &str, ui: &Ui, ctx: &Context, mouse_detector_level: MouseDetectorLevel, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>
pub fn check_mouse_detect_result( &self, name: &str, safe_mode: Option<bool>, ) -> Result<MouseDetectResult, RustConstructorError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for App
impl !RefUnwindSafe for App
impl !Send for App
impl !Sync for App
impl Unpin for App
impl !UnwindSafe for App
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
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().