Skip to content

Commit

Permalink
janitor: Use SharedString instead of String in GL renderer image cache
Browse files Browse the repository at this point in the history
We can avoid a string copy.
  • Loading branch information
tronical committed Jun 2, 2022
1 parent 1d8cb05 commit 22af9c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/backends/gl/images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ impl CachedImage {

#[derive(PartialEq, Eq, Hash, Debug, derive_more::From)]
pub enum ImageCacheKey {
Path(String),
Path(SharedString),
EmbeddedData(by_address::ByAddress<&'static [u8]>),
}

Expand All @@ -474,7 +474,7 @@ impl ImageCacheKey {
if path.is_empty() {
return None;
}
path.to_string().into()
path.clone().into()
}
ImageInner::EmbeddedData { data, format: _ } => {
by_address::ByAddress(data.as_slice()).into()
Expand Down

0 comments on commit 22af9c0

Please sign in to comment.