mirror of
https://github.com/emilk/egui.git
synced 2026-09-03 15:20:05 -04:00
egui_extras: always depend on log crate (#3336)
* egui_extras: always depend on `log` crate * syntax_highlighting fix: "serde" is always on * Add "serde" flag to egui when using egui_extras
This commit is contained in:
@@ -76,7 +76,7 @@ impl BytesLoader for EhttpLoader {
|
||||
Poll::Pending => Ok(BytesPoll::Pending { size: None }),
|
||||
}
|
||||
} else {
|
||||
crate::log_trace!("started loading {uri:?}");
|
||||
log::trace!("started loading {uri:?}");
|
||||
|
||||
let uri = uri.to_owned();
|
||||
cache.insert(uri.clone(), Poll::Pending);
|
||||
@@ -90,11 +90,11 @@ impl BytesLoader for EhttpLoader {
|
||||
Ok(response) => File::from_response(&uri, response),
|
||||
Err(err) => {
|
||||
// Log details; return summary
|
||||
crate::log_err!("Failed to load {uri:?}: {err}");
|
||||
log::error!("Failed to load {uri:?}: {err}");
|
||||
Err(format!("Failed to load {uri:?}"))
|
||||
}
|
||||
};
|
||||
crate::log_trace!("finished loading {uri:?}");
|
||||
log::trace!("finished loading {uri:?}");
|
||||
let prev = cache.lock().insert(uri, Poll::Ready(result));
|
||||
assert!(matches!(prev, Some(Poll::Pending)));
|
||||
ctx.request_repaint();
|
||||
|
||||
@@ -49,7 +49,7 @@ impl BytesLoader for FileLoader {
|
||||
Poll::Pending => Ok(BytesPoll::Pending { size: None }),
|
||||
}
|
||||
} else {
|
||||
crate::log_trace!("started loading {uri:?}");
|
||||
log::trace!("started loading {uri:?}");
|
||||
// We need to load the file at `path`.
|
||||
|
||||
// Set the file to `pending` until we finish loading it.
|
||||
@@ -85,7 +85,7 @@ impl BytesLoader for FileLoader {
|
||||
let prev = cache.lock().insert(path, Poll::Ready(result));
|
||||
assert!(matches!(prev, Some(Poll::Pending)));
|
||||
ctx.request_repaint();
|
||||
crate::log_trace!("finished loading {_uri:?}");
|
||||
log::trace!("finished loading {_uri:?}");
|
||||
}
|
||||
})
|
||||
.expect("failed to spawn thread");
|
||||
|
||||
@@ -62,9 +62,9 @@ impl ImageLoader for ImageCrateLoader {
|
||||
return Err(LoadError::NotSupported);
|
||||
}
|
||||
|
||||
crate::log_trace!("started loading {uri:?}");
|
||||
log::trace!("started loading {uri:?}");
|
||||
let result = crate::image::load_image_bytes(&bytes).map(Arc::new);
|
||||
crate::log_trace!("finished loading {uri:?}");
|
||||
log::trace!("finished loading {uri:?}");
|
||||
cache.insert(uri.into(), result.clone());
|
||||
match result {
|
||||
Ok(image) => Ok(ImagePoll::Ready { image }),
|
||||
|
||||
@@ -47,7 +47,7 @@ impl ImageLoader for SvgLoader {
|
||||
} else {
|
||||
match ctx.try_load_bytes(&uri) {
|
||||
Ok(BytesPoll::Ready { bytes, .. }) => {
|
||||
crate::log_trace!("started loading {uri:?}");
|
||||
log::trace!("started loading {uri:?}");
|
||||
let fit_to = match size_hint {
|
||||
SizeHint::Scale(factor) => usvg::FitTo::Zoom(factor.into_inner()),
|
||||
SizeHint::Width(w) => usvg::FitTo::Width(w),
|
||||
@@ -56,7 +56,7 @@ impl ImageLoader for SvgLoader {
|
||||
};
|
||||
let result =
|
||||
crate::image::load_svg_bytes_with_size(&bytes, fit_to).map(Arc::new);
|
||||
crate::log_trace!("finished loading {uri:?}");
|
||||
log::trace!("finished loading {uri:?}");
|
||||
cache.insert((uri, size_hint), result.clone());
|
||||
match result {
|
||||
Ok(image) => Ok(ImagePoll::Ready { image }),
|
||||
|
||||
Reference in New Issue
Block a user