impl Domain for Arc<D: Domain>
This commit is contained in:
parent
17d8d076ec
commit
5b9c4d29f6
|
@ -11,6 +11,7 @@ use std::marker::PhantomData;
|
|||
use std::ops::Index;
|
||||
use std::ops::IndexMut;
|
||||
use std::string::String;
|
||||
use std::sync::Arc;
|
||||
use std::vec::Vec;
|
||||
|
||||
pub use std::collections::BTreeSet as Set;
|
||||
|
@ -25,6 +26,16 @@ pub trait Domain: Sized + Debug + Clone + Eq + Hash + Ord {
|
|||
fn as_preserves(&self) -> IOValue;
|
||||
}
|
||||
|
||||
impl<D: Domain> Domain for Arc<D> {
|
||||
fn from_preserves(v: IOValue) -> IOResult<Self> {
|
||||
Ok(Arc::new(D::from_preserves(v)?))
|
||||
}
|
||||
|
||||
fn as_preserves(&self) -> IOValue {
|
||||
D::as_preserves(self)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait NestedValue<D: Domain>: Sized + Debug + Clone + Eq + Hash + Ord {
|
||||
fn wrap(anns: Annotations<Self, D>, v: Value<Self, D>) -> Self;
|
||||
|
||||
|
@ -1046,8 +1057,6 @@ impl<'de, Dom: Domain> serde::Deserialize<'de> for RcValue<Dom> {
|
|||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
pub struct ArcValue<D: Domain>(Arc<AnnotatedValue<ArcValue<D>, D>>);
|
||||
|
||||
|
|
Loading…
Reference in New Issue