pub struct Input<'a, 'b, T, R>{ /* private fields */ }Expand description
Type that have a inner closure
if Input<…> impl From<TYPE> then TYPE can be used as input closure
Implementations§
Source§impl<'a, 'b, T, R> Input<'a, 'b, T, R>
impl<'a, 'b, T, R> Input<'a, 'b, T, R>
Sourcepub fn new(param: Box<dyn FnMut(&'b T) -> R + 'a>) -> Self
pub fn new(param: Box<dyn FnMut(&'b T) -> R + 'a>) -> Self
Allows to create new Input from Box<dyn FnMut(&T)->R>
§you mustn’t use it because`
-
if you have
F:FnMut(...)you can useinput()fromutils -
you can use shorter
new_input()fromutils -
It is almost always better to use
input()because it takes any type that can convert into Input<…>
But if you have Box<F:FnMut(...)> and push it in input()
it converts into Box<Box<dyn FnMut(...)>>, because Box<F:Fn...> impl Fn...
Whatever it happens, use new_input()`
§Examples
use maller::{Maller, new_input};
let mut mr=Maller::new();
let input=Box::new(|x|x+100);
let input=new_input(input);
mr.insert(0,input);
Trait Implementations§
Auto Trait Implementations§
impl<'a, 'b, T, R> Freeze for Input<'a, 'b, T, R>
impl<'a, 'b, T, R> !RefUnwindSafe for Input<'a, 'b, T, R>
impl<'a, 'b, T, R> !Send for Input<'a, 'b, T, R>
impl<'a, 'b, T, R> !Sync for Input<'a, 'b, T, R>
impl<'a, 'b, T, R> Unpin for Input<'a, 'b, T, R>
impl<'a, 'b, T, R> !UnwindSafe for Input<'a, 'b, T, R>
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