App

Struct App 

Source
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: f32

RC资源刷新率。

§current_page: String

当前页面。

§timer: Timer

计时器。

§frame_times: Vec<f32>

帧时间。

§last_frame_time: Option<f64>

上一帧时间。

Implementations§

Source§

impl App

Source

pub fn strict_mode(self, strict_mode: bool) -> Self

Source

pub fn safe_mode(self, safe_mode: bool) -> Self

Source

pub fn tick_interval(self, tick_interval: f32) -> Self

Source

pub fn current_page(self, current_page: &str) -> Self

Source

pub fn page_handler(&mut self, ctx: &Context)

整合所有页面需要一次性处理的功能。

Source

pub fn add_page(&mut self, page_data: PageData)

运行时添加新页面。

Source

pub fn switch_page( &mut self, name: &str, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>

切换页面。

Source

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,

从指定列表中替换资源。

Source

pub fn replace_resource<T>( &mut self, name: &str, discern_type: &str, resource: T, ) -> Result<(), RustConstructorError>
where T: RustConstructorResource + 'static,

从列表中替换资源。

Source

pub fn get_resource<T>( &self, name: &str, discern_type: &str, ) -> Result<Option<&T>, RustConstructorError>
where T: RustConstructorResource + 'static,

从列表中获取不可变资源。

Source

pub fn get_resource_mut<T>( &mut self, name: &str, discern_type: &str, ) -> Result<&mut T, RustConstructorError>
where T: RustConstructorResource + 'static,

从列表中获取可变资源。

Source

pub fn check_resource_exists(&self, name: &str, discern_type: &str) -> bool

检查是否存在特定资源。

Source

pub fn add_fonts(&mut self, font: Font) -> Result<(), RustConstructorError>

添加字体资源。

Source

pub fn font( &mut self, name: &str, safe_mode: Option<bool>, ) -> Result<FontDefinitions, RustConstructorError>

输出字体资源。

Source

pub fn register_all_fonts(&mut self, ctx: &Context, safe_mode: Option<bool>)

将所有已添加到RC的字体资源添加到egui中。

Source

pub fn problem_report( &mut self, problem_type: RustConstructorError, severity_level: SeverityLevel, )

发生问题时推送报告。

Source

pub fn problem_report_custom( &self, problem_type: RustConstructorError, severity_level: SeverityLevel, problem_storage: Vec<Problem>, )

发生问题时向指定列表推送报告。

Source

pub fn check_updated( &mut self, name: &str, safe_mode: Option<bool>, ) -> Result<bool, RustConstructorError>

检查页面是否已完成首次加载。

Source

pub fn check_enter_updated( &mut self, name: &str, safe_mode: Option<bool>, ) -> Result<bool, RustConstructorError>

检查页面是否已完成加载。

Source

pub fn new_page_update( &mut self, name: &str, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>

进入新页面时的更新。

Source

pub fn update_frame_stats(&mut self, ctx: &Context)

更新帧数。

Source

pub fn current_fps(&self) -> f32

更新帧数显示。

Source

pub fn add_split_time(&mut self, split_time: SplitTime)

添加分段时间。

Source

pub fn reset_split_time( &mut self, name: &str, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>

重置分段时间。

Source

pub fn split_time( &self, name: &str, safe_mode: Option<bool>, ) -> Result<[f32; 2], RustConstructorError>

输出分段时间。

Source

pub fn update_timer(&mut self)

更新计时器。

Source

pub fn add_custom_rect(&mut self, custom_rect: CustomRect)

添加矩形资源。

Source

pub fn custom_rect( &mut self, name: &str, ui: &mut Ui, ctx: &Context, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>

显示矩形资源。

Source

pub fn add_text(&mut self, text: Text)

添加文本资源。

Source

pub fn text( &mut self, name: &str, ui: &mut Ui, ctx: &Context, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>

显示文本资源。

Source

pub fn add_var<T: Debug + 'static>(&mut self, variable: Variable<T>)

添加变量资源。

Source

pub fn modify_var<T: Debug + 'static>( &mut self, name: &str, value: Option<T>, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>

修改变量资源。

Source

pub fn var<T: Debug + 'static>( &self, name: &str, safe_mode: Option<bool>, ) -> Result<Option<&T>, RustConstructorError>

取出变量。

Source

pub fn add_image_texture( &mut self, image_texture: ImageTexture, path: &str, flip: [bool; 2], ctx: &Context, )

添加图片纹理资源。

Source

pub fn image_texture( &self, name: &str, safe_mode: Option<bool>, ) -> Result<Option<DebugTextureHandle>, RustConstructorError>

输出图片纹理。

Source

pub fn reset_image_texture( &mut self, name: &str, path: &str, flip: [bool; 2], ctx: &Context, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>

重置图片纹理。

Source

pub fn add_image( &mut self, image: Image, image_texture_name: &str, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>

添加图片资源。

Source

pub fn image( &mut self, name: &str, ui: &mut Ui, ctx: &Context, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>

显示图片资源。

Source

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>

添加消息框资源。

Source

pub fn message_box_display( &mut self, ctx: &Context, ui: &mut Ui, safe_mode: Option<bool>, )

处理所有已添加的消息框资源。

Source

pub fn add_switch( &mut self, switch: Switch, fill_resource_name: &str, fill_resource_type: &str, text_name: &str, ) -> Result<(), RustConstructorError>

添加开关资源。

Source

pub fn switch( &mut self, name: &str, ui: &mut Ui, ctx: &Context, enable: bool, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>

显示开关资源。

Source

pub fn check_switch_data( &self, name: &str, safe_mode: Option<bool>, ) -> Result<SwitchData, RustConstructorError>

查找指定开关的常用判定字段集合。

Source

pub fn add_mouse_detector(&mut self, mouse_detector: MouseDetector)

添加鼠标检测器资源。

Source

pub fn mouse_detector( &mut self, name: &str, ui: &Ui, ctx: &Context, mouse_detector_level: MouseDetectorLevel, safe_mode: Option<bool>, ) -> Result<(), RustConstructorError>

Source

pub fn check_mouse_detect_result( &self, name: &str, safe_mode: Option<bool>, ) -> Result<MouseDetectResult, RustConstructorError>

Trait Implementations§

Source§

impl Debug for App

Source§

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

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

impl Default for App

Source§

fn default() -> Self

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

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