MCPcopy Index your code
hub / github.com/encounter/objdiff / queue

Method queue

objdiff-gui/src/views/file.rs:24–41  ·  view source on GitHub ↗
(&mut self, init: InitCb, result_cb: ResultCb)

Source from the content-addressed store, hash-verified

22
23impl FileDialogState {
24 pub fn queue<InitCb, ResultCb>(&mut self, init: InitCb, result_cb: ResultCb)
25 where
26 InitCb: FnOnce() -> Pin<Box<dyn Future<Output = Option<FileHandle>> + Send>>,
27 ResultCb: FnOnce(Utf8PlatformPathBuf) -> FileDialogResult + Send + 'static,
28 {
29 if self.thread.is_some() {
30 return;
31 }
32 let future = init();
33 self.thread = Some(std::thread::spawn(move || {
34 if let Some(handle) = future.block_on() {
35 let path = PathBuf::from(handle);
36 check_path_buf(path).map(result_cb).unwrap_or(FileDialogResult::None)
37 } else {
38 FileDialogResult::None
39 }
40 }));
41 }
42
43 pub fn poll(&mut self) -> FileDialogResult {
44 if let Some(thread) = &mut self.thread {

Callers 2

config_uiFunction · 0.80
split_obj_config_uiFunction · 0.80

Calls 3

initFunction · 0.85
check_path_bufFunction · 0.85
is_someMethod · 0.80

Tested by

no test coverage detected