Skip to content

Instantly share code, notes, and snippets.

@davll
Created April 5, 2016 13:03
Show Gist options
  • Select an option

  • Save davll/a57025771dc9e279a30c75f084c9ba8a to your computer and use it in GitHub Desktop.

Select an option

Save davll/a57025771dc9e279a30c75f084c9ba8a to your computer and use it in GitHub Desktop.
vectormath lib pastes
/// Comparison
pub trait Cmp {
/// Corresponding boolean type
type Bool;
/// Test equality
fn eq(self, rhs: Self) -> Self::Bool;
/// Test inequality
fn ne(self, rhs: Self) -> Self::Bool;
/// Test greater than
fn gt(self, rhs: Self) -> Self::Bool;
/// Test less than
fn lt(self, rhs: Self) -> Self::Bool;
/// Test greater than or equal to
fn ge(self, rhs: Self) -> Self::Bool;
/// Test less than or equal to
fn le(self, rhs: Self) -> Self::Bool;
}
/// Selection
pub trait Select : Cmp {
/// Element-wise selection
fn sel(self, rhs: Self, cond: Self::Bool);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment