Skip to content

Commit

Permalink
Merge pull request #34 from tgecho/more-impls
Browse files Browse the repository at this point in the history
Add a few missing impls
  • Loading branch information
tgecho authored Dec 1, 2024
2 parents d14d5f8 + 635c30f commit 60b78d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion canrun/src/collections/lvec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::rc::Rc;
///
/// Construct with the [`lvec!`](crate::lvec!) macro, or you can use the
/// `From<Vec<Value<T>>>` or `FromIterator<Value<T>>` trait implementations.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct LVec<T: Unify> {
vec: Vec<Value<T>>,
}
Expand Down
13 changes: 12 additions & 1 deletion canrun/src/core/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ debugging purposes as no guarantees are made about the type or generation of
the id value. Also, these ids are only valid within the context of a single
execution. They cannot be safely persisted or shared between processes.
*/
#[derive(Debug, Copy, Eq)]
#[derive(Debug, Copy)]
pub struct LVar<T> {
pub(crate) id: VarId,
t: PhantomData<T>,
}

impl<T> Eq for LVar<T> {}

impl<T> PartialEq for LVar<T> {
fn eq(&self, other: &LVar<T>) -> bool {
self.id == other.id
Expand Down Expand Up @@ -212,3 +214,12 @@ impl<T: Unify> Clone for Value<T> {
}
}
}

#[cfg(test)]
mod test {
use crate::LVar;

#[allow(dead_code)]
trait ImplsEq: Eq {}
impl ImplsEq for LVar<f32> {}
}

0 comments on commit 60b78d9

Please sign in to comment.