remove some latent todos!()
This commit is contained in:
1 parent
32e46d98be
commit
90e988cbdb
3 files changed
+24
-47
No files matched your search
@@ -367,28 +367,9 @@ impl NativeFileData for DesktopFileData {
|
||||
>,
|
||||
> {
|
||||
let path = self.0.clone();
|
||||
#[cfg(feature = "tokio_runtime")]
|
||||
{
|
||||
// todo!()
|
||||
// use futures_util::TryFutureExt;
|
||||
|
||||
// futures_util::stream::try_unfold(File::open(path), |mut file| async move {
|
||||
// let mut buf = vec![0; 8192];
|
||||
// let n = file
|
||||
// .read(&mut buf)
|
||||
// .await
|
||||
// .map_err(|e| dioxus_core::CapturedError::from(e))?;
|
||||
// if n == 0 {
|
||||
// Ok(None)
|
||||
// } else {
|
||||
// buf.truncate(n);
|
||||
// Ok(Some((bytes::Bytes::from(buf), file)))
|
||||
// }
|
||||
// })
|
||||
// .map(|res| res.map(bytes::Bytes::from))
|
||||
// .boxed()
|
||||
}
|
||||
todo!()
|
||||
Box::pin(futures_util::stream::once(async move {
|
||||
Ok(bytes::Bytes::from(std::fs::read(&path)?))
|
||||
}))
|
||||
}
|
||||
|
||||
fn content_type(&self) -> Option<String> {
|
||||
|
||||
@@ -151,30 +151,13 @@ mod ser {
|
||||
|
||||
impl From<&DragData> for SerializedDataTransfer {
|
||||
fn from(_drag: &DragData) -> Self {
|
||||
todo!()
|
||||
// let items = vec![]; // drag.data_transfer().items().iter().map(|item| SerializedDataTransferItem {
|
||||
// // kind: item.kind().to_string(),
|
||||
// // type_: item.type_().to_string(),
|
||||
// // data: item.data().unwrap_or_default(),
|
||||
// // }).collect();
|
||||
|
||||
// let files = drag
|
||||
// .files()
|
||||
// .iter()
|
||||
// .map(|f| crate::file_data::SerializedFileData {
|
||||
// name: f.name().to_string(),
|
||||
// size: f.size(),
|
||||
// type_: f.type_().to_string(),
|
||||
// })
|
||||
// .collect();
|
||||
|
||||
// Self {
|
||||
// items,
|
||||
// files,
|
||||
// effect_allowed: drag.effect_allowed().to_string(),
|
||||
// drop_effect: drag.drop_effect().to_string(),
|
||||
// }
|
||||
// }
|
||||
// todo!()
|
||||
Self {
|
||||
items: vec![],
|
||||
files: vec![],
|
||||
effect_allowed: "all".into(),
|
||||
drop_effect: "none".into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -297,7 +297,20 @@ mod serialize {
|
||||
}
|
||||
|
||||
fn values(&self) -> Vec<(String, FormValue)> {
|
||||
todo!()
|
||||
self.values
|
||||
.iter()
|
||||
.map(|v| {
|
||||
let value = if let Some(text) = &v.text {
|
||||
FormValue::Text(text.clone())
|
||||
} else if let Some(_file) = &v.file {
|
||||
// todo: we lose the file contents here
|
||||
FormValue::File(None)
|
||||
} else {
|
||||
FormValue::File(None)
|
||||
};
|
||||
(v.key.clone(), value)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn valid(&self) -> bool {
|
||||
|
||||
Reference in new issue
Block a user