mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-09-20 20:59:05 +03:00
chore: remove unnecessary anonymous lifetimes (#1829)
This commit is contained in:
parent
9a60c1053f
commit
c1f8e11342
@ -341,7 +341,7 @@ where
|
||||
/// struct MyString(String);
|
||||
///
|
||||
/// #[tauri::command]
|
||||
/// fn int_command(state: State<'_, MyInt>) -> String {
|
||||
/// fn int_command(state: State<MyInt>) -> String {
|
||||
/// format!("The stateful int is: {}", state.0)
|
||||
/// }
|
||||
///
|
||||
|
@ -22,6 +22,6 @@ pub fn simple_command(argument: String) {
|
||||
}
|
||||
|
||||
#[command]
|
||||
pub fn stateful_command(argument: Option<String>, state: State<'_, super::MyState>) {
|
||||
pub fn stateful_command(argument: Option<String>, state: State<super::MyState>) {
|
||||
println!("{:?} {:?}", argument, state.inner());
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ mod ui {
|
||||
#[tauri::command]
|
||||
fn close_splashscreen<P: Params>(
|
||||
_: Window<P>, // force inference of P
|
||||
splashscreen: State<'_, SplashscreenWindow<P>>,
|
||||
main: State<'_, MainWindow<P>>,
|
||||
splashscreen: State<SplashscreenWindow<P>>,
|
||||
main: State<MainWindow<P>>,
|
||||
) {
|
||||
// Close splashscreen
|
||||
splashscreen.0.lock().unwrap().close().unwrap();
|
||||
|
@ -23,17 +23,17 @@ struct Counter(AtomicUsize);
|
||||
struct Database(Arc<Mutex<HashMap<String, String>>>);
|
||||
|
||||
#[tauri::command]
|
||||
fn increment_counter(counter: State<'_, Counter>) -> usize {
|
||||
fn increment_counter(counter: State<Counter>) -> usize {
|
||||
counter.0.fetch_add(1, Ordering::Relaxed) + 1
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn db_insert(key: String, value: String, db: State<'_, Database>) {
|
||||
fn db_insert(key: String, value: String, db: State<Database>) {
|
||||
db.0.lock().unwrap().insert(key, value);
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn db_read(key: String, db: State<'_, Database>) -> Option<String> {
|
||||
fn db_read(key: String, db: State<Database>) -> Option<String> {
|
||||
db.0.lock().unwrap().get(&key).cloned()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user