Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a few missing impls #34

Merged
merged 2 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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> {}
}