Add support for fetching/rendering images
This commit is contained in:
parent
6d4dd0e7a4
commit
99ad60460a
7 changed files with 161 additions and 32 deletions
|
@ -1,11 +1,22 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
#[derive(PartialEq, Eq, Hash)]
|
||||
#[derive(PartialEq, Eq)]
|
||||
pub enum ArcCow<'a, T: ?Sized> {
|
||||
Borrowed(&'a T),
|
||||
Owned(Arc<T>),
|
||||
}
|
||||
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
impl<'a, T: ?Sized + Hash> Hash for ArcCow<'a, T> {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
match self {
|
||||
Self::Borrowed(borrowed) => Hash::hash(borrowed, state),
|
||||
Self::Owned(owned) => Hash::hash(&**owned, state),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: ?Sized> Clone for ArcCow<'a, T> {
|
||||
fn clone(&self) -> Self {
|
||||
match self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue