pub struct LogWindow<'a> {
pub enabled: bool,
pub window_pose: Pose,
pub x_len: f32,
pub y_len: f32,
pub log_log: &'a Mutex<Vec<LogItem>>,
/* private fields */
}
Expand description
A simple log window to display the logs.
§Fields that can be changed before initialization:
log_log
- The log mutex to listen to.enabled
- Whether the tool is enabled or not at start.window_pose
- The pose where to show the log window.x_len
- The width in number of characters.y_len
- The height of the log window in number of lines.
§Events this stepper is listening to:
SHOW_LOG_WINDOW
- Event that triggers when the window is visible (“true”) or hidden (“false”).
§Examples
use stereokit_rust::{maths::Vec3, ui::Ui,
tools::log_window::{LogWindow, basic_log_fmt, SHOW_LOG_WINDOW},
system::{LogLevel, LogItem, Log}};
use std::sync::Mutex;
// Somewhere to copy the log
static LOG_LOG: Mutex<Vec<LogItem>> = Mutex::new(vec![]);
let fn_mut = |level: LogLevel, log_text: &str| {
let items = LOG_LOG.lock().unwrap();
basic_log_fmt(level, log_text, 20, items);
};
Log::subscribe(fn_mut);
let mut log_window = LogWindow::new(&LOG_LOG);
log_window.window_pose = Ui::popup_pose([0.0, 0.04, 1.40]);
log_window.x_len = 20.0;
log_window.y_len = 4.0;
sk.send_event(StepperAction::add("LogWindow", log_window));
filename_scr = "screenshots/log_window.jpeg";
test_screenshot!( // !!!! Get a proper main loop !!!!
if iter == 0 {
Log::info("Info log message");
Log::warn("Warning log message");
Log::err ("Error log message");
} else if iter == number_of_steps {
sk.send_event(StepperAction::event( "main", SHOW_LOG_WINDOW, "false",));
}
);

Fields§
§enabled: bool
§window_pose: Pose
§x_len: f32
§y_len: f32
§log_log: &'a Mutex<Vec<LogItem>>
Implementations§
Trait Implementations§
Source§impl<'a> IStepper for LogWindow<'a>
impl<'a> IStepper for LogWindow<'a>
Source§fn enabled(&self) -> bool
fn enabled(&self) -> bool
Is this IStepper enabled? When false, StereoKit will not call Step. This can be a good way to temporarily
disable the IStepper without removing or shutting it down.
https://stereokit.net/Pages/StereoKit.Framework/IStepper/Enabled.html
Source§fn initialize(&mut self, id: StepperId, sk_info: Rc<RefCell<SkInfo>>) -> bool
fn initialize(&mut self, id: StepperId, sk_info: Rc<RefCell<SkInfo>>) -> bool
This is called by StereoKit at the start of the next frame, and on the main thread. This happens before
StereoKit’s main Step callback, and always after Sk.initialize.
https://stereokit.net/Pages/StereoKit.Framework/IStepper/Initialize.html
id : The id of the stepper
sk : The SkInfo of the runnin Sk instance. Read more
Source§fn step(&mut self, token: &MainThreadToken)
fn step(&mut self, token: &MainThreadToken)
This Step method will be called every frame of the application, as long as Enabled is true. This happens
immediately before the main application’s Step callback.
https://stereokit.net/Pages/StereoKit.Framework/IStepper/Step.html
Source§fn initialize_done(&mut self) -> bool
fn initialize_done(&mut self) -> bool
If initialization is to be performed in multiple steps, with or without threads and in order to avoid black or
frozen screens, write the on going initialization here Read more
Source§fn shutdown(&mut self)
fn shutdown(&mut self)
This is called when the IStepper is removed, or the application shuts down. This is always called on the main
thread, and happens at the start of the next frame, before the main application’s Step callback.
https://stereokit.net/Pages/StereoKit.Framework/IStepper/Shutdown.html
Source§fn shutdown_done(&mut self) -> bool
fn shutdown_done(&mut self) -> bool
If shutdown is to be performed in multiple steps, with or without threads and in order to avoid black or
frozen screens, write the on going shutdown here Read more
impl Send for LogWindow<'_>
Auto Trait Implementations§
impl<'a> Freeze for LogWindow<'a>
impl<'a> !RefUnwindSafe for LogWindow<'a>
impl<'a> !Sync for LogWindow<'a>
impl<'a> Unpin for LogWindow<'a>
impl<'a> !UnwindSafe for LogWindow<'a>
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.