forked from M-Labs/nalgebra
Improve Ops API
This commit is contained in:
parent
fe8592fde1
commit
061024ab1f
@ -15,10 +15,7 @@ pub enum Op<T> {
|
||||
impl<T> Op<T> {
|
||||
/// TODO
|
||||
pub fn inner_ref(&self) -> &T {
|
||||
match self {
|
||||
Op::NoOp(obj) => &obj,
|
||||
Op::Transpose(obj) => &obj
|
||||
}
|
||||
self.as_ref().unwrap()
|
||||
}
|
||||
|
||||
/// TODO
|
||||
@ -33,10 +30,7 @@ impl<T> Op<T> {
|
||||
pub fn convert<U>(self) -> Op<U>
|
||||
where T: Into<U>
|
||||
{
|
||||
match self {
|
||||
Op::NoOp(obj) => Op::NoOp(obj.into()),
|
||||
Op::Transpose(obj) => Op::Transpose(obj.into())
|
||||
}
|
||||
self.map_same_op(T::into)
|
||||
}
|
||||
|
||||
/// TODO
|
||||
@ -47,6 +41,13 @@ impl<T> Op<T> {
|
||||
Op::Transpose(obj) => Op::Transpose(f(obj))
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO
|
||||
pub fn unwrap(self) -> T {
|
||||
match self {
|
||||
Op::NoOp(obj) | Op::Transpose(obj) => obj,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<T> for Op<T> {
|
||||
|
Loading…
Reference in New Issue
Block a user