Struct winit_input_map::InputMap
source · pub struct InputMap<const BINDS: usize> {
pub binds: [Vec<Input>; BINDS],
pub pressing: [bool; BINDS],
pub pressed: [bool; BINDS],
pub released: [bool; BINDS],
pub mouse_move: (f32, f32),
pub mouse_pos: (f32, f32),
}
Expand description
input system. define actions and their key binds and then see if their pressing, pressed or released. get mouse position and how much its moved. you can use anythin that implements the Into<usize>
trait as an action, but it’s recommended to use an action enum.
enum Actions{
Debug,
Left,
Right,
Click
}
impl Into<usize> for Actions{
fn into(self) -> usize {
self as usize
}
}
use input::{InputMap, Input};
use Actions::*;
let mut input = Input::new([
(vec![Input::keycode(KeyCode::Space)], Debug),
(vec![Input::keycode(KeyCode::ArrowLeft), InputCode::keycode(KeyCode::KeyA)], Left),
(vec![Input::keycode(KeyCode::ArrowRight), InputCode::keycode(KeyCode::KeyD)], Right),
(vec![Input::Mouse(MouseButton::Left)], Click)
]);
use winit::{event::*, keyboard::KeyCode, window::WindowAttribures};
let event_loop = winit::event_loop::EventLoop::new().unwrap();
event_loop.set_control_flow(winit::event_loop::ControlFlow::Poll);
let _window = event_loop.create_window(WindowAttribures::default()).unwrap();
event_loop.run(|event, target|{
input.update(&event);
match &event {
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => { target.exit() },
Event::AboutToWait => {
if input.pressed(Debug) { println!("pressed {:?}", input.binds(Debug)) }
if input.pressing(Right) || input.pressing(Left) { println!("axis: {}", input.axis(Right, Left)) }
if input.mouse_move != (0.0, 0.0) { println!("mouse moved: {:?} and is now at {:?}", input.mouse_move, input.mouse_pos) }
if input.released(Click) { println!("released {:?}", input.binds(Click)) }
std::thread::sleep(std::time::Duration::from_millis(100));
//since init is required to be called once before update, we put it at the end before it loops.
input.init(); //could also use `init_hide_mouse()`
}
_ => ()
}
}).unwrap();
Fields§
§binds: [Vec<Input>; BINDS]
§pressing: [bool; BINDS]
§pressed: [bool; BINDS]
§released: [bool; BINDS]
§mouse_move: (f32, f32)
§mouse_pos: (f32, f32)
Implementations§
source§impl<const BINDS: usize> InputMap<BINDS>
impl<const BINDS: usize> InputMap<BINDS>
sourcepub fn new(binds: [(Vec<Input>, impl Into<usize>); BINDS]) -> Self
pub fn new(binds: [(Vec<Input>, impl Into<usize>); BINDS]) -> Self
create new input system. recommended to use an action enum which implements the Into<usize>
trait for the second value.
enum Action{
Forward,
Back,
Left,
Right
}
impl Into<usize> for Action{
fn into(self) -> usize{
self as usize
}
}
use Action::*;
use input::{Input, InputCode};
use winit::keyboard::KeyCode;
//doesnt have to be the same ordered as the enum.
let mut input = Input::new([
(vec![Input::keycode(KeyCode::KeyW)], Forward),
(vec![Input::keycode(KeyCode::KeyA)], Left),
(vec![Input::keycode(KeyCode::KeyS)], Back),
(vec![Input::keycode(KeyCode::KeyD)], Right)
]);
Examples found in repository?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
fn main() {
enum Actions {
Debug,
Left,
Right,
Click,
}
impl Into<usize> for Actions {
fn into(self) -> usize {
self as usize
}
}
use winit_input_map::{Input, InputMap};
use Actions::*;
let mut input = InputMap::new([
(vec![Input::keycode(KeyCode::Space)], Debug),
(
vec![
Input::keycode(KeyCode::ArrowLeft),
Input::keycode(KeyCode::KeyA),
],
Left,
),
(
vec![
Input::keycode(KeyCode::ArrowRight),
Input::keycode(KeyCode::KeyD),
],
Right,
),
(vec![Input::Mouse(MouseButton::Left)], Click),
]);
use winit::{event::*, keyboard::KeyCode, window::WindowAttributes};
let event_loop = winit::event_loop::EventLoop::new().unwrap();
event_loop.set_control_flow(winit::event_loop::ControlFlow::Poll);
let _window = event_loop
.create_window(WindowAttributes::default())
.unwrap();
event_loop
.run(|event, target| {
input.update(&event);
match &event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => target.exit(),
Event::AboutToWait => {
if input.pressed(Debug) {
println!("pressed {:?}", input.binds(Debug))
}
if input.pressing(Right) || input.pressing(Left) {
println!("axis: {}", input.axis(Right, Left))
}
if input.mouse_move != (0.0, 0.0) {
println!(
"mouse moved: {:?} and is now at {:?}",
input.mouse_move, input.mouse_pos
)
}
if input.released(Click) {
println!("released {:?}", input.binds(Click))
}
std::thread::sleep(std::time::Duration::from_millis(100));
//since init is required to be called once before update, we put it at the end before it loops.
input.init(); //could use `init_hide_mouse()` instead. good for camera controls
}
_ => (),
}
})
.unwrap();
}
sourcepub fn update(&mut self, event: &Event<()>)
pub fn update(&mut self, event: &Event<()>)
updates the input using a winit event. requires input.init()
to be used before being updated.
use winit::event::*;
use input::Input;
let mut event_loop = winit::event_loop::EventLoopBuilder::new().build().unwrap();
event_loop.set_control_flow(winit::event_loop::ControlFlow::Poll);
let mut input = Input::new([]);
event_loop.run(|event, target|{
input.update(&event);
match &event{
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => target.exit(),
Event::AboutToWait => input.init(), //could also use `init_hide_mouse()`
_ => ()
}
});
Examples found in repository?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
fn main() {
enum Actions {
Debug,
Left,
Right,
Click,
}
impl Into<usize> for Actions {
fn into(self) -> usize {
self as usize
}
}
use winit_input_map::{Input, InputMap};
use Actions::*;
let mut input = InputMap::new([
(vec![Input::keycode(KeyCode::Space)], Debug),
(
vec![
Input::keycode(KeyCode::ArrowLeft),
Input::keycode(KeyCode::KeyA),
],
Left,
),
(
vec![
Input::keycode(KeyCode::ArrowRight),
Input::keycode(KeyCode::KeyD),
],
Right,
),
(vec![Input::Mouse(MouseButton::Left)], Click),
]);
use winit::{event::*, keyboard::KeyCode, window::WindowAttributes};
let event_loop = winit::event_loop::EventLoop::new().unwrap();
event_loop.set_control_flow(winit::event_loop::ControlFlow::Poll);
let _window = event_loop
.create_window(WindowAttributes::default())
.unwrap();
event_loop
.run(|event, target| {
input.update(&event);
match &event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => target.exit(),
Event::AboutToWait => {
if input.pressed(Debug) {
println!("pressed {:?}", input.binds(Debug))
}
if input.pressing(Right) || input.pressing(Left) {
println!("axis: {}", input.axis(Right, Left))
}
if input.mouse_move != (0.0, 0.0) {
println!(
"mouse moved: {:?} and is now at {:?}",
input.mouse_move, input.mouse_pos
)
}
if input.released(Click) {
println!("released {:?}", input.binds(Click))
}
std::thread::sleep(std::time::Duration::from_millis(100));
//since init is required to be called once before update, we put it at the end before it loops.
input.init(); //could use `init_hide_mouse()` instead. good for camera controls
}
_ => (),
}
})
.unwrap();
}
sourcepub fn init_hide_mouse(&mut self, window: &mut Window)
pub fn init_hide_mouse(&mut self, window: &mut Window)
hides and centres mouse. usefull for camera controls, use instead of input.init()
required to put input.init()
before input.update()
use winit::{event::*, window::WindowAttribures};
use input::InputMap;
let mut event_loop = winit::event_loop::EventLoopBuilder::new().build().unwrap();
event_loop.set_control_flow(winit::event_loop::ControlFlow::Poll);
let mut window = event_loop.create_window(WindowAttribures::default());
let mut input = InputMap::new([]);
event_loop.run(|event, target|{
input.update(&event);
match &event{
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => target.exit(),
Event::AboutToWait => input.init_hide_mouse(&mut window),
_ => ()
}
});
sourcepub fn init(&mut self)
pub fn init(&mut self)
initialise input. required to be called for mouse_move
, pressed()
and released()
to work.
required to put input.init()
before input.update()
use winit::event::*;
use input::InputMap;
let mut event_loop = winit::event_loop::EventLoopBuilder::new().build().unwrap();
event_loop.set_control_flow(winit::event_loop::ControlFlow::Poll);
let mut input = InputMap::new([]);
event_loop.run(|event, target|{
input.update(&event);
match &event{
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => target.exit(),
Event::AboutToWait => input.init(),
_ => ()
}
});
Examples found in repository?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
fn main() {
enum Actions {
Debug,
Left,
Right,
Click,
}
impl Into<usize> for Actions {
fn into(self) -> usize {
self as usize
}
}
use winit_input_map::{Input, InputMap};
use Actions::*;
let mut input = InputMap::new([
(vec![Input::keycode(KeyCode::Space)], Debug),
(
vec![
Input::keycode(KeyCode::ArrowLeft),
Input::keycode(KeyCode::KeyA),
],
Left,
),
(
vec![
Input::keycode(KeyCode::ArrowRight),
Input::keycode(KeyCode::KeyD),
],
Right,
),
(vec![Input::Mouse(MouseButton::Left)], Click),
]);
use winit::{event::*, keyboard::KeyCode, window::WindowAttributes};
let event_loop = winit::event_loop::EventLoop::new().unwrap();
event_loop.set_control_flow(winit::event_loop::ControlFlow::Poll);
let _window = event_loop
.create_window(WindowAttributes::default())
.unwrap();
event_loop
.run(|event, target| {
input.update(&event);
match &event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => target.exit(),
Event::AboutToWait => {
if input.pressed(Debug) {
println!("pressed {:?}", input.binds(Debug))
}
if input.pressing(Right) || input.pressing(Left) {
println!("axis: {}", input.axis(Right, Left))
}
if input.mouse_move != (0.0, 0.0) {
println!(
"mouse moved: {:?} and is now at {:?}",
input.mouse_move, input.mouse_pos
)
}
if input.released(Click) {
println!("released {:?}", input.binds(Click))
}
std::thread::sleep(std::time::Duration::from_millis(100));
//since init is required to be called once before update, we put it at the end before it loops.
input.init(); //could use `init_hide_mouse()` instead. good for camera controls
}
_ => (),
}
})
.unwrap();
}
sourcepub fn binds(&mut self, action: impl Into<usize>) -> &mut Vec<Input>
pub fn binds(&mut self, action: impl Into<usize>) -> &mut Vec<Input>
get binds of action. same as self.binds[action.into()]
Examples found in repository?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
fn main() {
enum Actions {
Debug,
Left,
Right,
Click,
}
impl Into<usize> for Actions {
fn into(self) -> usize {
self as usize
}
}
use winit_input_map::{Input, InputMap};
use Actions::*;
let mut input = InputMap::new([
(vec![Input::keycode(KeyCode::Space)], Debug),
(
vec![
Input::keycode(KeyCode::ArrowLeft),
Input::keycode(KeyCode::KeyA),
],
Left,
),
(
vec![
Input::keycode(KeyCode::ArrowRight),
Input::keycode(KeyCode::KeyD),
],
Right,
),
(vec![Input::Mouse(MouseButton::Left)], Click),
]);
use winit::{event::*, keyboard::KeyCode, window::WindowAttributes};
let event_loop = winit::event_loop::EventLoop::new().unwrap();
event_loop.set_control_flow(winit::event_loop::ControlFlow::Poll);
let _window = event_loop
.create_window(WindowAttributes::default())
.unwrap();
event_loop
.run(|event, target| {
input.update(&event);
match &event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => target.exit(),
Event::AboutToWait => {
if input.pressed(Debug) {
println!("pressed {:?}", input.binds(Debug))
}
if input.pressing(Right) || input.pressing(Left) {
println!("axis: {}", input.axis(Right, Left))
}
if input.mouse_move != (0.0, 0.0) {
println!(
"mouse moved: {:?} and is now at {:?}",
input.mouse_move, input.mouse_pos
)
}
if input.released(Click) {
println!("released {:?}", input.binds(Click))
}
std::thread::sleep(std::time::Duration::from_millis(100));
//since init is required to be called once before update, we put it at the end before it loops.
input.init(); //could use `init_hide_mouse()` instead. good for camera controls
}
_ => (),
}
})
.unwrap();
}
sourcepub fn pressing(&self, action: impl Into<usize>) -> bool
pub fn pressing(&self, action: impl Into<usize>) -> bool
checks if action is being pressed currently. same as self.pressing[action.into()]
Examples found in repository?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
fn main() {
enum Actions {
Debug,
Left,
Right,
Click,
}
impl Into<usize> for Actions {
fn into(self) -> usize {
self as usize
}
}
use winit_input_map::{Input, InputMap};
use Actions::*;
let mut input = InputMap::new([
(vec![Input::keycode(KeyCode::Space)], Debug),
(
vec![
Input::keycode(KeyCode::ArrowLeft),
Input::keycode(KeyCode::KeyA),
],
Left,
),
(
vec![
Input::keycode(KeyCode::ArrowRight),
Input::keycode(KeyCode::KeyD),
],
Right,
),
(vec![Input::Mouse(MouseButton::Left)], Click),
]);
use winit::{event::*, keyboard::KeyCode, window::WindowAttributes};
let event_loop = winit::event_loop::EventLoop::new().unwrap();
event_loop.set_control_flow(winit::event_loop::ControlFlow::Poll);
let _window = event_loop
.create_window(WindowAttributes::default())
.unwrap();
event_loop
.run(|event, target| {
input.update(&event);
match &event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => target.exit(),
Event::AboutToWait => {
if input.pressed(Debug) {
println!("pressed {:?}", input.binds(Debug))
}
if input.pressing(Right) || input.pressing(Left) {
println!("axis: {}", input.axis(Right, Left))
}
if input.mouse_move != (0.0, 0.0) {
println!(
"mouse moved: {:?} and is now at {:?}",
input.mouse_move, input.mouse_pos
)
}
if input.released(Click) {
println!("released {:?}", input.binds(Click))
}
std::thread::sleep(std::time::Duration::from_millis(100));
//since init is required to be called once before update, we put it at the end before it loops.
input.init(); //could use `init_hide_mouse()` instead. good for camera controls
}
_ => (),
}
})
.unwrap();
}
sourcepub fn pressed(&self, action: impl Into<usize>) -> bool
pub fn pressed(&self, action: impl Into<usize>) -> bool
checks if action was just pressed. same as self.pressed[action.into()]
Examples found in repository?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
fn main() {
enum Actions {
Debug,
Left,
Right,
Click,
}
impl Into<usize> for Actions {
fn into(self) -> usize {
self as usize
}
}
use winit_input_map::{Input, InputMap};
use Actions::*;
let mut input = InputMap::new([
(vec![Input::keycode(KeyCode::Space)], Debug),
(
vec![
Input::keycode(KeyCode::ArrowLeft),
Input::keycode(KeyCode::KeyA),
],
Left,
),
(
vec![
Input::keycode(KeyCode::ArrowRight),
Input::keycode(KeyCode::KeyD),
],
Right,
),
(vec![Input::Mouse(MouseButton::Left)], Click),
]);
use winit::{event::*, keyboard::KeyCode, window::WindowAttributes};
let event_loop = winit::event_loop::EventLoop::new().unwrap();
event_loop.set_control_flow(winit::event_loop::ControlFlow::Poll);
let _window = event_loop
.create_window(WindowAttributes::default())
.unwrap();
event_loop
.run(|event, target| {
input.update(&event);
match &event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => target.exit(),
Event::AboutToWait => {
if input.pressed(Debug) {
println!("pressed {:?}", input.binds(Debug))
}
if input.pressing(Right) || input.pressing(Left) {
println!("axis: {}", input.axis(Right, Left))
}
if input.mouse_move != (0.0, 0.0) {
println!(
"mouse moved: {:?} and is now at {:?}",
input.mouse_move, input.mouse_pos
)
}
if input.released(Click) {
println!("released {:?}", input.binds(Click))
}
std::thread::sleep(std::time::Duration::from_millis(100));
//since init is required to be called once before update, we put it at the end before it loops.
input.init(); //could use `init_hide_mouse()` instead. good for camera controls
}
_ => (),
}
})
.unwrap();
}
sourcepub fn released(&self, action: impl Into<usize>) -> bool
pub fn released(&self, action: impl Into<usize>) -> bool
checks if action was just released. same as self.released[action.into()]
Examples found in repository?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
fn main() {
enum Actions {
Debug,
Left,
Right,
Click,
}
impl Into<usize> for Actions {
fn into(self) -> usize {
self as usize
}
}
use winit_input_map::{Input, InputMap};
use Actions::*;
let mut input = InputMap::new([
(vec![Input::keycode(KeyCode::Space)], Debug),
(
vec![
Input::keycode(KeyCode::ArrowLeft),
Input::keycode(KeyCode::KeyA),
],
Left,
),
(
vec![
Input::keycode(KeyCode::ArrowRight),
Input::keycode(KeyCode::KeyD),
],
Right,
),
(vec![Input::Mouse(MouseButton::Left)], Click),
]);
use winit::{event::*, keyboard::KeyCode, window::WindowAttributes};
let event_loop = winit::event_loop::EventLoop::new().unwrap();
event_loop.set_control_flow(winit::event_loop::ControlFlow::Poll);
let _window = event_loop
.create_window(WindowAttributes::default())
.unwrap();
event_loop
.run(|event, target| {
input.update(&event);
match &event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => target.exit(),
Event::AboutToWait => {
if input.pressed(Debug) {
println!("pressed {:?}", input.binds(Debug))
}
if input.pressing(Right) || input.pressing(Left) {
println!("axis: {}", input.axis(Right, Left))
}
if input.mouse_move != (0.0, 0.0) {
println!(
"mouse moved: {:?} and is now at {:?}",
input.mouse_move, input.mouse_pos
)
}
if input.released(Click) {
println!("released {:?}", input.binds(Click))
}
std::thread::sleep(std::time::Duration::from_millis(100));
//since init is required to be called once before update, we put it at the end before it loops.
input.init(); //could use `init_hide_mouse()` instead. good for camera controls
}
_ => (),
}
})
.unwrap();
}
sourcepub fn axis(&self, pos: impl Into<usize>, neg: impl Into<usize>) -> f32
pub fn axis(&self, pos: impl Into<usize>, neg: impl Into<usize>) -> f32
returns 1.0 if pos is pressed, -1.0 if neg is pressed or 0.0 if either pos and neg or nothing is pressed. usefull for movement controls. same as input::axis(input.pressing(pos), input.pressing(neg))
let move_dir = (input.axis(Right, Left), input.axis(Up, Down));
Examples found in repository?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
fn main() {
enum Actions {
Debug,
Left,
Right,
Click,
}
impl Into<usize> for Actions {
fn into(self) -> usize {
self as usize
}
}
use winit_input_map::{Input, InputMap};
use Actions::*;
let mut input = InputMap::new([
(vec![Input::keycode(KeyCode::Space)], Debug),
(
vec![
Input::keycode(KeyCode::ArrowLeft),
Input::keycode(KeyCode::KeyA),
],
Left,
),
(
vec![
Input::keycode(KeyCode::ArrowRight),
Input::keycode(KeyCode::KeyD),
],
Right,
),
(vec![Input::Mouse(MouseButton::Left)], Click),
]);
use winit::{event::*, keyboard::KeyCode, window::WindowAttributes};
let event_loop = winit::event_loop::EventLoop::new().unwrap();
event_loop.set_control_flow(winit::event_loop::ControlFlow::Poll);
let _window = event_loop
.create_window(WindowAttributes::default())
.unwrap();
event_loop
.run(|event, target| {
input.update(&event);
match &event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => target.exit(),
Event::AboutToWait => {
if input.pressed(Debug) {
println!("pressed {:?}", input.binds(Debug))
}
if input.pressing(Right) || input.pressing(Left) {
println!("axis: {}", input.axis(Right, Left))
}
if input.mouse_move != (0.0, 0.0) {
println!(
"mouse moved: {:?} and is now at {:?}",
input.mouse_move, input.mouse_pos
)
}
if input.released(Click) {
println!("released {:?}", input.binds(Click))
}
std::thread::sleep(std::time::Duration::from_millis(100));
//since init is required to be called once before update, we put it at the end before it loops.
input.init(); //could use `init_hide_mouse()` instead. good for camera controls
}
_ => (),
}
})
.unwrap();
}
Auto Trait Implementations§
impl<const BINDS: usize> Freeze for InputMap<BINDS>
impl<const BINDS: usize> RefUnwindSafe for InputMap<BINDS>
impl<const BINDS: usize> Send for InputMap<BINDS>
impl<const BINDS: usize> Sync for InputMap<BINDS>
impl<const BINDS: usize> Unpin for InputMap<BINDS>
impl<const BINDS: usize> UnwindSafe for InputMap<BINDS>
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
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>
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>
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)
&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)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.