NullCore

Struct NullCore 

Source
pub struct NullCore;
Expand description

A Core that does nothing.

Trait Implementations§

Source§

impl Core for NullCore

Source§

fn init(&mut self) -> Result<(), Error>

Initialize the core and anything needed for it to run.
Source§

fn name(&self) -> &str

Return a human-readable name for the core.
Source§

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>

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>

Sets the time in the core’s RTC.
Source§

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>

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>

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>

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_rom(&mut self, _rom: Rom) -> Result<(), Error>

Load a ROM into the core.
Source§

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_up(&mut self, _key: Scancode) -> Result<(), Error>

Send a key up event to the core.
Source§

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>

Set the keys that are currently pressed, releasing the keys that are not in the list.
Source§

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.
Source§

fn gamepad_button_up( &mut self, _index: usize, _button: Button, ) -> Result<(), Error>

Source§

fn gamepad_button_down( &mut self, _index: usize, _button: Button, ) -> Result<(), Error>

Source§

fn gamepad_buttons_set( &mut self, _index: usize, _buttons: ButtonSet, ) -> Result<(), Error>

Source§

fn gamepad_buttons(&self, _index: usize) -> Result<Option<ButtonSet>, Error>

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>

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>

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>

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>

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>

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).
Source§

fn as_any(&self) -> &dyn Any

Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Source§

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

Returns true if the core should quit. Some cores might want to quit back to the main menu by themselves.

Auto Trait Implementations§

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