pub struct NullCore;Expand description
A Core that does nothing.
Trait Implementations§
Source§impl Core for NullCore
impl Core for NullCore
Source§fn init(&mut self) -> Result<(), Error>
fn init(&mut self) -> Result<(), Error>
Initialize the core and anything needed for it to run.
Source§fn reset(&mut self) -> Result<(), Error>
fn reset(&mut self) -> Result<(), Error>
Reset the core, restarting the ROM from the beginning.
Source§fn set_volume(&mut self, _volume: u8) -> Result<(), Error>
fn set_volume(&mut self, _volume: u8) -> Result<(), Error>
Update the volume of a core. This value is to be taken as a linear
scale from 0-256 requested from the user. If the core takes a
logarithmic scale, it should convert it to the appropriate value.
Source§fn set_rtc(&mut self, _time: SystemTime) -> Result<(), Error>
fn set_rtc(&mut self, _time: SystemTime) -> Result<(), Error>
Sets the time in the core’s RTC.
Source§fn screenshot(&self) -> Result<DynamicImage, Error>
fn screenshot(&self) -> Result<DynamicImage, Error>
Take a screenshot (if supported), returning the image.
Source§fn save_state_mut(
&mut self,
_slot: usize,
) -> Result<Option<&mut dyn SaveState>, Error>
fn save_state_mut( &mut self, _slot: usize, ) -> Result<Option<&mut dyn SaveState>, Error>
Get the save state at a specific slot.
If the core does not support save states, this should return
None for all slots.
If the core supports save states, but the slot index is out of bound, this should
return None.Source§fn save_state(&self, _slot: usize) -> Result<Option<&dyn SaveState>, Error>
fn save_state(&self, _slot: usize) -> Result<Option<&dyn SaveState>, Error>
Get the save state at a specific slot.
If the core does not support save states, this should return
None for all slots.
If the core supports save states, but the slot index is out of bound, this should
return None.Source§fn mounted_file_mut(
&mut self,
_slot: usize,
) -> Result<Option<&mut dyn MountedFile>, Error>
fn mounted_file_mut( &mut self, _slot: usize, ) -> Result<Option<&mut dyn MountedFile>, Error>
Get the mounted save file at a specific slot.
If the core does not support mounting files, this should return
None for all slots.
If the core supports mounting files, but the slot index is out of bound, this should
return None.Source§fn send_bios(&mut self, _bios: Bios) -> Result<(), Error>
fn send_bios(&mut self, _bios: Bios) -> Result<(), Error>
Load a BIOS into the core. For cores that support multiple BIOS, the BIOS should be
selected based on the core’s configuration and the slot information should be part
of [
&dyn Bios].Source§fn key_down(&mut self, _key: Scancode) -> Result<(), Error>
fn key_down(&mut self, _key: Scancode) -> Result<(), Error>
Send a key down event to the core.
Source§fn keys_set(&mut self, _keys: ScancodeSet) -> Result<(), Error>
fn keys_set(&mut self, _keys: ScancodeSet) -> Result<(), Error>
Set the keys that are currently pressed, releasing the keys that are not in
the list.
Source§fn keys(&self) -> Result<ScancodeSet, Error>
fn keys(&self) -> Result<ScancodeSet, Error>
Return a slice of the keys that are currently pressed. The order of the
keys in the slice is not guaranteed.
Returns the gamepad buttons that are currently pressed. The order of the
buttons in the slice is not guaranteed.
If the core does not support gamepads at the index requested, this should
return
None.Source§fn settings(&self) -> Result<CoreSettings, Error>
fn settings(&self) -> Result<CoreSettings, Error>
Returns the menu items that the core supports. This would correspond to the
top level page of config items. If the core does not support a menu, this
should return an empty vector.
Source§fn trigger(&mut self, _id: SettingId) -> Result<(), Error>
fn trigger(&mut self, _id: SettingId) -> Result<(), Error>
Trigger a menu item in the core. This is used to perform an action based on
the menu item selected by the user. It can also be linked to a shortcut.
Source§fn file_select(&mut self, _id: SettingId, _path: String) -> Result<(), Error>
fn file_select(&mut self, _id: SettingId, _path: String) -> Result<(), Error>
Send a file path to the core. This is used to load files into the core.
Source§fn int_option(&mut self, _id: SettingId, _value: u32) -> Result<u32, Error>
fn int_option(&mut self, _id: SettingId, _value: u32) -> Result<u32, Error>
Set an integer option in the core. This is used to set an option that has a
positive integer value. Returns the new value (e.g. if value is out of bound,
the core might clip it or reset it).
Source§fn bool_option(&mut self, _id: SettingId, _value: bool) -> Result<bool, Error>
fn bool_option(&mut self, _id: SettingId, _value: bool) -> Result<bool, Error>
Set a boolean option in the core. This is used to set an option that has a
boolean value that can be toggled by the user. Returns the new value
(e.g. if the core cannot change the value, returns the previous one).
fn as_any(&self) -> &dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Source§fn quit(&mut self)
fn quit(&mut self)
Indicates to the core that it needs to prepare quitting.
This is used to perform any cleanup that the core needs to do before quitting.
When the core is ready, [should_quit()] should return true.
Source§fn should_quit(&self) -> bool
fn should_quit(&self) -> bool
Returns true if the core should quit. Some cores might want to quit
back to the main menu by themselves.
Auto Trait Implementations§
impl Freeze for NullCore
impl RefUnwindSafe for NullCore
impl Send for NullCore
impl Sync for NullCore
impl Unpin for NullCore
impl UnwindSafe for NullCore
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> 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 more